-
Notifications
You must be signed in to change notification settings - Fork 28
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
Replace axios
with fetch based alternative
#373
Comments
No upload progress is a big deal breaker for us, we'll have to drop this dependency now. |
@mattiaz9 sorry to hear that, but I am happy you raised your issue! Well, we could do that, but I am not sure if it would solve anything. Are you developing on browser-side or NodeJS? To my knowledge, it is not possible to provide nor mock the upload tracking in browsers. If you know about a way please let me know. Well, the only thing I can think of is an XHR wrapper that has a It is possible to do this in NodeJS and it is something we plan to do as per this issue: #397 |
@AuHau I'm developing on browser not Node. I found this: https://github.com/lifeomic/axios-fetch which should build a |
Well, I have not exactly used custom But even if |
Or I guess you could use its "Transforming requests" functionality to catch the request and append an upload-progress callback to it and then track the progress? 🤔 That said, this workaround would for example break the download streaming which was one of the reason for adopting |
Btw. please also comment on this issue to push the WHATWG to implement proper upload progress tracking for |
I'm not familiar with the download streaming. That being said the option to override fetch could be implemented in only the api that allows that. Regarding the upload progress, that would be managed by the axios instance so in theory you wouldn't need to expose anything. Example:
|
I see, that is interesting. We will discuss this. Thanks for the input! |
@mattiaz9 we discussed this and we are on-board for this solution. We will validate that the solution you propose indeed will yield the wanted result and if so, then we will implement it! 👍 |
@AuHau sounds great, thanks! |
Currently, we are using
axios
library to make HTTP requests. It is based on an XHR client in a browser that is old and obsolete and is not further developed.fetch
is the current standard for making modern requests. It for example supports streaming responses from server, which XHR does not support. And in future it will most probably support even streaming requests. We should therefore switch to either nativefetch
or some fetch's based library.I propose to use
ky
(or its isomorphic versionky-universal
) that shares a lot of the same API withfetch
but adds some small but important behaviors and functionality like:The text was updated successfully, but these errors were encountered: