Merge branch 'hotfix/mock_flat' into develop
Former-commit-id: 4f12558d9013ddf94178f383155963d2dbc0ce74 [formerly 4f12558d9013ddf94178f383155963d2dbc0ce74 [formerly 4f12558d9013ddf94178f383155963d2dbc0ce74 [formerly 4f12558d9013ddf94178f383155963d2dbc0ce74 [formerly 023d3df30a12391b09825cedf5bf9c64501bd8ab [formerly 235bb7b12ddbf799880031aa01077f415171cc23]]]]] Former-commit-id: 358d8e104fd4c92f8237db9f4b662f0b29996ffa Former-commit-id: 8a3821fb8292c16ec93b759fe69eaf476417aeb3 Former-commit-id: a908004402917c9b7f049ae253ac1ae2f789f5aa [formerly cd226fb245fda6648f52caefa9d6d2d3edfa38bf] Former-commit-id: b934c1367c98ea47e7dd9e8d8571a2a401ed1c9d Former-commit-id: 3e87e32d0766b09cc9c5b7375511e8612ebe519e Former-commit-id: 2ce4bff0d9e276b303241386079a251094b76cf4 Former-commit-id: 8ffad4aa0d4255a84023e04670424fa9d1df0217 Former-commit-id: a1f754aac9edbe5669178dd8b1100b24c02a722c
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import Mock from 'mockjs'
|
||||
|
||||
// 补丁 解决 mock.js 影响 Cookie 携带
|
||||
import PatchCookie from './patch/cookie'
|
||||
|
||||
PatchCookie(Mock)
|
||||
// 解决 Mock 情况下,携带 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题
|
||||
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
|
||||
Mock.XHR.prototype.send = function () {
|
||||
if (this.custom.xhr) {
|
||||
this.custom.xhr.withCredentials = this.withCredentials || false
|
||||
}
|
||||
this.proxy_send(...arguments)
|
||||
}
|
||||
|
||||
// 导入所有的接口
|
||||
const req = context => context.keys().map(context)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
export default function (Mock) {
|
||||
// 解决 Mock 情况下,携带 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题
|
||||
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
|
||||
Mock.XHR.prototype.send = function () {
|
||||
if (this.custom.xhr) {
|
||||
this.custom.xhr.withCredentials = this.withCredentials || false
|
||||
}
|
||||
this.proxy_send(...arguments)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user