-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Feature request: fetch based adapter #1219
Comments
👍 |
Agreed. This looks like a dealbreaker for using Axios in PWAs, because the serviceworker can only intercept and cache http requests sent via the Discussed in #484 |
Just noticed this after diving into service workers this week. Is isomorphic-fetch a viable alternative for PWAs? |
@jabacchetta I have no experience with PWAs yet but I would think so. If you want something sort of axios like, https://github.com/jackfranklin/so-fetch, looks good (haven't tried it yet personally though). |
Great, thanks! I'll take a look. |
Is there any implementation for 'fetch adapter' in progress? otherwise I can work on it |
@NShahri I haven't started on anything yet, sadly |
@ccnokes Ok, I will send pull request soon |
I actually just started working on this too (don't let this discourage you @NShahri, yours might be better or I might not finish it, etc). Still hoping for some positive signal from a maintainer. @nickuraltsev or @mzabriskie any thoughts on this? I haven't gotten too far into the implementation yet but I know one question that'll come up is do you explicitly opt into the fetch adapter or does it take precedence over the |
@ccnokes, at the moment I change the code to choose fetch adapter when fetch is available otherwise it will choose XHR adapter. Also I am using whatwg-fetch polyfill in test environment as it lets me to run the all current tests against fetch adapter with minimum changes. This polyfill uses XHR to implement fetch, so I can use it on test environment for running current XHR tests for fetch adapter. But I am no sure about this approach. In addition I have another question about 'withCredentials' as I think it can be mapped to I am working on 22 failed test to finalise the implementation and send pull request. |
@ccnokes this is my first try to implement fetch adapter https://github.com/axios/axios/compare/master...NShahri:feature/fetch-adapter?w=1 Remaining tasks:
|
Nice @NShahri! Let me know if you need help with anything. |
Thanks @ccnokes, Feel free to start implementing any of remaining tasks. let me know which one you started to avoid both of us working on the same task. |
Hey @NShahri sorry for the delay, I'll take a look this week at the Redirects task. How should we do this? Should I fork/PR you or do you want me just committing directly to your fork? |
@ccnokes sorry for delay. |
Hey guys, any progress on this? I would LOVE to keep using axios, but I need to implement thx |
@eybarta The minimum requirements are implemented and tested, but I haven't use this in any app. It would be great if you have time and use it in your app. https://github.com/NShahri/axios/tree/feature/fetch-adapter There is a list of remaining tasks in #1219 (comment). NOTE:
Next phase to finalise |
are all the remaining task done and released? |
Personally, I'd be wary of working on adding fetch support as a PR, especially as there hasn't been any interest shown from maintainers. Also I noticed there's a 1.0.0 version in the plans: https://github.com/axios/axios/projects/2. Maybe a fetch adapter will be a part of that? |
It'd be great if a fetch adapter can be part of 1.0.0. It'd solve a lot of issues I have with |
@ccnokes This issue is already solved, close please. |
@juanarbol What PR was it fixed in? I can't find the fetch adapter in the codebase. |
My bad, if anyone could explain me how to solve, I could help |
Any news on this? When using react native, fetch seems to be way faster than xhr to process json responses and it would be great to use a fetch adapter. |
👍 |
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
As far as I know we can not have a upload progress percentage with fetch base technology , Are you going to implement a adapter without supporting upload progress feature ? |
@mh-alahdadian i haven't gotten that far yet. streams aren't yet standardized on the web platform but perhaps there is a high-quality polyfill or workaround. in any case, i don't see why this would be a practical limitation. if you're in a browser environment, you can still use the XHR adapter, which supports the if you're in a node environment, you can use the in more exotic environments like CloudFlare Workers, where you only have access to fetch, this may be an unsupported feature until the spec lands, only because the runtime may not emit the requisite events. EDIT: @mh-alahdadian looks like |
One more reason in favor of a Thanks |
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
Another new JS runtime, |
For now I recommend |
cc / @jasonsaayman I'd still love to join discord and attack this; let me know if that's welcome at all :) |
This changeset adds a `fetch`-based adapter implementation to `axios`, powered by `cross-fetch`[1]. The implementation may thus be used on either Node or in browser environments. Changes enclosed: - Add `fetch` adapter implementation - Add `fetch` to standard built-in adapters - Add initial Node-side tests for `fetch` - Slight refactor to tests to use common setup / teardown code Still pending: - Upload/download progress events - Browser-side testing Fixes and closes axios#1219, and supersedes axios#2891.
Fetch adapter was added in v1.7.0-beta.0 |
I didn't see an issue for this (opened or closed), but if this is a duplicate just close it 😸 .
Are there any plans for a
fetch
based adapter for axios? I thought I'd check and see if this has been discussed, and if not, if you all would be open to a feature request (or I'm happy to work on it and PR it).Reasons for adding a
fetch
adapter are basically for the same reasons you'd use fetch:Reasons you'd still want axios wrapping fetch for you (because some people feel like you don't need a lib over fetch):
The text was updated successfully, but these errors were encountered: