-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
引入mock后,axios响应头的responseType失效,导致乱码了 #434
Comments
可以解决的,有两个方式,在拦截处判断响应头再进行 return。或者使用 https://github.com/wll8/mockm |
如果未匹配到数据模板,Mockjs会初始化原生XHR对象,这个过程导致设置axios里设置的responseType没有起作用。
这个过程中第2步的执行是没有将responseType值继承的。 #426 这个issue应该也不能解决这个问题,可能axios的config.responseType能在open前复值给request对象就可以了。 |
能不能给个具体的解决方法? |
可以不使用xhr,改为fetch获取文件blob。 (^o^)/~ |
这个仓库已经不维护了,我fork了一份已经解决,可以使用我fork的仓库 tony-mockjs
我的代码里里面使用了threejs,具体的responseType值会是 text|ArrayBuffer|json,目前工作良好 |
我在这个问题上也搞了好久,谁能想到是mockjs的问题啊😂 |
引入mock后,axios响应头的responseType:blob‘’失效,导致乱码了。。。。这个是否解决呢
The text was updated successfully, but these errors were encountered: