-
Notifications
You must be signed in to change notification settings - Fork 158
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
Passthrough for binary files not working #305
Comments
This is kind blocking. Without pretender |
Any solution found @mydea ? I made a entire app with pretender and found that issue too.. |
No, sadly not! |
I started to look at pretender source code and have found a solution. In create-passthrough.ts#L28 just check blob and arraybuffer response types, this solves the main issue with blob's. I found another issues, some events are firing twice and when using axios the event "readystatechange" are not firing properly depending on implementation. So, basically needs to replace the createPassthrough function from the file create-passthrough.ts with the changes (Changes explained prefixed by ### in comments):
And my tests code:
One more thing. In order to download files from web in localhost, its going to be needed to disabled browser CORS policy, in case of chrome see Disable CORS Chrome. Hope it helps @mydea! Regards. |
@ankology nice finding! Would you mind creat a PR with your change? |
I was facing this issue when using mirage js with pdf js
using it like this
|
Would be fantatsic if this was made into a PR, major bummer |
PR here with Ankology's fix |
I just spent many hours trying to figure out why a binary file sent via an API was always corrupted, until I found out it was because of Pretender passthrough somehow bungling it up.
I searched and found this: #148, but as far as I see this cannot be set when using
fetch()
.The text was updated successfully, but these errors were encountered: