From d2a4cf661ccaf8c4e9d2db68ed4c4a2e8d7823c0 Mon Sep 17 00:00:00 2001 From: springwang Date: Sat, 29 Sep 2018 09:08:26 +0800 Subject: [PATCH 1/2] fix #286 --- src/mock/xhr/xhr.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mock/xhr/xhr.js b/src/mock/xhr/xhr.js index daf2af4b..10935a76 100644 --- a/src/mock/xhr/xhr.js +++ b/src/mock/xhr/xhr.js @@ -264,6 +264,12 @@ Util.extend(MockXMLHttpRequest.prototype, { // 原生 XHR if (!this.match) { + // 修复timeout和withCredentials不生效的问题 + Util.extend(that.custom.xhr, { + timeout: that.timeout, + withCredentials: !!that.withCredentials + }); + this.custom.xhr.send(data) return } @@ -439,4 +445,4 @@ function convert(item, options) { item.template(options) : MockXMLHttpRequest.Mock.mock(item.template) } -module.exports = MockXMLHttpRequest \ No newline at end of file +module.exports = MockXMLHttpRequest From e397f15137fffede664fedf4642948e663021909 Mon Sep 17 00:00:00 2001 From: springwang Date: Sat, 29 Sep 2018 09:33:57 +0800 Subject: [PATCH 2/2] fix #286 --- src/mock/xhr/xhr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mock/xhr/xhr.js b/src/mock/xhr/xhr.js index 10935a76..4c00f6bc 100644 --- a/src/mock/xhr/xhr.js +++ b/src/mock/xhr/xhr.js @@ -267,7 +267,7 @@ Util.extend(MockXMLHttpRequest.prototype, { // 修复timeout和withCredentials不生效的问题 Util.extend(that.custom.xhr, { timeout: that.timeout, - withCredentials: !!that.withCredentials + withCredentials: that.withCredentials }); this.custom.xhr.send(data)