解决mockjs导致没有匹配拦截的请求withCredentials属性无效,丢失cookie

import Mock from 'mockjs'

Mock.XHR.prototype._original_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function() {
    if (this.custom.xhr) {
        this.custom.xhr.withCredentials = this.withCredentials || false
    }
    this._original_send(...arguments)
}

posted on 2022-04-11 22:37  路过君  阅读(66)  评论(0编辑  收藏  举报

导航