Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ function run_xhr(options) {
xhr.open(options.method, options.uri, true) // asynchronous
if(is_cors)
xhr.withCredentials = !! options.withCredentials

for (var key in options.headers)
xhr.setRequestHeader(key, options.headers[key])

xhr.send(options.body)
return xhr

Expand All @@ -209,8 +213,6 @@ function run_xhr(options) {

if(xhr.readyState === XHR.OPENED) {
request.log.debug('Request started', {'id':xhr.id})
for (var key in options.headers)
xhr.setRequestHeader(key, options.headers[key])
}

else if(xhr.readyState === XHR.HEADERS_RECEIVED)
Expand Down