Merge branch 'hotfix/mock_flat'
Former-commit-id: 14f12c6ca066be71474e08a5d7dcecdaf7702b9f [formerly 14f12c6ca066be71474e08a5d7dcecdaf7702b9f [formerly 14f12c6ca066be71474e08a5d7dcecdaf7702b9f [formerly 14f12c6ca066be71474e08a5d7dcecdaf7702b9f [formerly d65ae43963842bdc56b7d63b97db3eaa1907c686 [formerly 1119195197803dd3a3316de917dd02899add4d83]]]]] Former-commit-id: fcc844dab0e8242436a6520fc241ebfb92079323 Former-commit-id: 94200ee18983b3a2b3d82b35d293625cc1c631af Former-commit-id: 800f78f70bf9638edff6f274f7d914af1ac7650d [formerly dc26df92d7e7217855f9eb20a4b7fc91100ad841] Former-commit-id: a9cb0fb421e2e43ef279ada047f91d256435dfe1 Former-commit-id: fdd71672b20dd5068ddfffac18adcc39a975e7d9 Former-commit-id: 76e470db75c164f3b52f55cb914d833eeb62b5ff Former-commit-id: b39460780aa788015fd0ced2ef3b989e36f409b6 Former-commit-id: 16cd632f68d46f7f63e9e2f74ea5391339bcb556
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
import Mock from 'mockjs'
|
import Mock from 'mockjs'
|
||||||
|
|
||||||
// 补丁 解决 mock.js 影响 Cookie 携带
|
// 解决 Mock 情况下,携带 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题
|
||||||
import PatchCookie from './patch/cookie'
|
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
|
||||||
|
Mock.XHR.prototype.send = function () {
|
||||||
PatchCookie(Mock)
|
if (this.custom.xhr) {
|
||||||
|
this.custom.xhr.withCredentials = this.withCredentials || false
|
||||||
|
}
|
||||||
|
this.proxy_send(...arguments)
|
||||||
|
}
|
||||||
|
|
||||||
// 导入所有的接口
|
// 导入所有的接口
|
||||||
const req = context => context.keys().map(context)
|
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