From 03cda43f43adbe970c4d580c63fa69aba66a8c82 Mon Sep 17 00:00:00 2001 From: allevo Date: Tue, 31 Mar 2015 11:29:22 +0200 Subject: [PATCH] Add withCredentials property if already defined --- lib/mock.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/mock.js b/lib/mock.js index 5cfb3cf..30d03a8 100644 --- a/lib/mock.js +++ b/lib/mock.js @@ -443,14 +443,27 @@ function MockHttpServer (handler) { }; MockHttpServer.prototype = { + getProperties: function () { + var xhr = new XMLHttpRequest(); + return { + withCredentials: xhr.withCredentials + } + }, + start: function () { var self = this; + var props = this.getProperties(); + function Request () { this.onsend = function () { self.handle(this); }; MockHttpRequest.apply(this, arguments); + + for(var i in props) { + this[i] = props[i]; + } } Request.prototype = MockHttpRequest.prototype;