diff --git a/src/mock/xhr/xhr.js b/src/mock/xhr/xhr.js index daf2af4b..4c00f6bc 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