Permalink
Browse files

Webkit requires xhr to be open before setting headers

  • Loading branch information...
1 parent fcb1486 commit 19f215c1ed19717a5498a1b4ab632901cac17128 @dkastner dkastner committed Sep 7, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/request.js
View
4 lib/request.js
@@ -8,6 +8,8 @@ var Request = module.exports = function (xhr, params) {
var uri = params.host + ':' + params.port + (params.path || '/');
+ xhr.open(params.method || 'GET', 'http://' + uri, true);
+
if (params.headers) {
Object.keys(params.headers).forEach(function (key) {
var value = params.headers[key];
@@ -20,8 +22,6 @@ var Request = module.exports = function (xhr, params) {
});
}
- xhr.open(params.method || 'GET', 'http://' + uri, true);
-
var res = new Response;
res.on('ready', function () {
self.emit('response', res);

0 comments on commit 19f215c

Please sign in to comment.