Skip to content

Commit 67200dd

Browse files
committed
fix setRequestHeaders for IE
1 parent d99a386 commit 67200dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ function run_xhr(options) {
198198
xhr.open(options.method, options.uri, true) // asynchronous
199199
if(is_cors)
200200
xhr.withCredentials = !! options.withCredentials
201+
202+
for (var key in options.headers)
203+
xhr.setRequestHeader(key, options.headers[key])
204+
201205
xhr.send(options.body)
202206
return xhr
203207

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

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

216218
else if(xhr.readyState === XHR.HEADERS_RECEIVED)

0 commit comments

Comments
 (0)