Skip to content

Commit 0565aab

Browse files
committed
Expose xhr.withCredentials with correct default
Fixes #71 Replaces #84
1 parent 17b03f9 commit 0565aab

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
@@ -363,7 +367,8 @@ exports.XMLHttpRequest = function() {
363367
path: uri,
364368
method: settings.method,
365369
headers: headers,
366-
agent: false
370+
agent: false,
371+
withCredentials: self.withCredentials
367372
};
368373

369374
// Reset error flag
@@ -399,7 +404,8 @@ exports.XMLHttpRequest = function() {
399404
port: url.port,
400405
path: url.path,
401406
method: response.statusCode === 303 ? "GET" : settings.method,
402-
headers: headers
407+
headers: headers,
408+
withCredentials: self.withCredentials
403409
};
404410

405411
// Issue the new request

0 commit comments

Comments
 (0)