Skip to content

Commit 078626a

Browse files
committed
Merge pull request #96 from kumavis/patch-1
Expose xhr.withCredentials with correct default
2 parents 65a970d + 0565aab commit 078626a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/XMLHttpRequest.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ exports.XMLHttpRequest = function() {
110110
this.responseXML = "";
111111
this.status = null;
112112
this.statusText = null;
113+
114+
// Whether cross-site Access-Control requests should be made using
115+
// credentials such as cookies or authorization headers
116+
this.withCredentials = false;
113117

114118
/**
115119
* Private methods
@@ -364,7 +368,8 @@ exports.XMLHttpRequest = function() {
364368
path: uri,
365369
method: settings.method,
366370
headers: headers,
367-
agent: false
371+
agent: false,
372+
withCredentials: self.withCredentials
368373
};
369374

370375
// Reset error flag
@@ -400,7 +405,8 @@ exports.XMLHttpRequest = function() {
400405
port: url.port,
401406
path: url.path,
402407
method: response.statusCode === 303 ? "GET" : settings.method,
403-
headers: headers
408+
headers: headers,
409+
withCredentials: self.withCredentials
404410
};
405411

406412
// Issue the new request

0 commit comments

Comments
 (0)