From 67200dd4ec133457fb7dc69f005540f92b543f0a Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 30 Dec 2014 11:35:58 -0300 Subject: [PATCH] fix setRequestHeaders for IE --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 1a77c6f..a77b663 100644 --- a/index.js +++ b/index.js @@ -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 @@ -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)