Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require mock后请求无法带cookie #286

Open
hudk114 opened this issue Apr 20, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@hudk114
Copy link

commented Apr 20, 2018

hi作者好
下午在公司帮同事调东西的时候遇到了一个bug,在项目中require了mock之后,所有的请求、即使不通过mock,请求头都没法带上cookie
大概看了下源码,window.XMLHttpRequest被XHR替换了,而这个XHR里貌似把withCredentials设置成了false,所以请求都没法带上cookie。#234遇到的应该也是这个问题
建议是否可在Mock里加一个options,定义是否要替换原生的xhr方法,而不是在require的时候直接替换;或者对不走mock的接口直接调用原生的xhr,比如#285,应该都能解决这个问题
多谢!

@pleasureswx123

This comment has been minimized.

Copy link

commented May 23, 2018

应该加上withCredentials的setter和getter

springwang added a commit to springwang/Mock that referenced this issue Sep 29, 2018

springwang added a commit to springwang/Mock that referenced this issue Sep 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.