From 336eae7e5f49ec60078321fb2855ce7bfacffd14 Mon Sep 17 00:00:00 2001 From: "Woodson, Marques (Contractor)" Date: Wed, 10 Sep 2014 10:57:19 -0500 Subject: [PATCH] Added method for setting withCredentials. Can be set to either true or false. Assertion added to the test-request-methods.js tests. --- lib/XMLHttpRequest.js | 6 ++++++ tests/test-request-methods.js | 3 +++ 2 files changed, 9 insertions(+) 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") {