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

希望可以增加对fetch请求的拦截 #218

Open
xieyu33333 opened this issue Aug 16, 2017 · 2 comments
Open

希望可以增加对fetch请求的拦截 #218

xieyu33333 opened this issue Aug 16, 2017 · 2 comments

Comments

@xieyu33333
Copy link

RT~

@fwgood
Copy link

fwgood commented Nov 13, 2017

同希望,文档里没有提到不支持fetch 使用的时候发现一直报错json解析错误,后来才发现因为没有拦截fetch 直接请求了index.html

@zjffun
Copy link

zjffun commented Jun 15, 2019

貌似作者已经不维护了,下面是一个支持拦截 fetch 的版本 zjffun/Mock-support-intercept-fetch

使用的话:

npm install @zjffun/mockjs

fetch 的拦截还是比较好实现的,因为拦截后返回 resolve 为 response 对象(通过 Response - Web APIs | MDN 创建)的 promise 对象就行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants