diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 4b7cab4..665d47d 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -22,6 +22,7 @@ exports.XMLHttpRequest = function() { var self = this; var http = require('http'); var https = require('https'); + var withCredentials = true; // Holds http.js objects var request; @@ -505,6 +506,11 @@ exports.XMLHttpRequest = function() { } }; + this.withCredentials = function(state) { + withCredentials = state; + return withCredentials; + }; + /** * Called when an error is encountered to deal with it. */ diff --git a/tests/test-request-methods.js b/tests/test-request-methods.js index fa1b1be..15c2b03 100644 --- a/tests/test-request-methods.js +++ b/tests/test-request-methods.js @@ -36,6 +36,9 @@ function start(method) { // Reset each time xhr = new XMLHttpRequest(); + var withCreds = xhr.withCredentials(false); + assert.equal(false, withCreds); + xhr.onreadystatechange = function() { if (this.readyState == 4) { if (method == "HEAD") {