We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f7cf7e commit 97261a2Copy full SHA for 97261a2
src/mock/index.js
@@ -4,6 +4,16 @@ import articleAPI from './article'
4
import remoteSearchAPI from './remoteSearch'
5
import transactionAPI from './transaction'
6
7
+// 修复在使用 MockJS 情况下,设置 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题
8
+// https://github.com/nuysoft/Mock/issues/300
9
+Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
10
+Mock.XHR.prototype.send = function() {
11
+ if (this.custom.xhr) {
12
+ this.custom.xhr.withCredentials = this.withCredentials || false
13
+ }
14
+ this.proxy_send(...arguments)
15
+}
16
+
17
// Mock.setup({
18
// timeout: '350-600'
19
// })
0 commit comments