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

feat(adapter): add fetch adapter; #6371

Merged
merged 42 commits into from Apr 28, 2024

Conversation

DigitalBrainJS
Copy link
Collaborator

The goal of this PR is to add a minimal fetch implementation that provides the same capabilities as the xhr adapter without major changes, allowing it to be released in Axios 1.x.
To avoid breaking changes, by default fetch adapter will be used if the xhr and http adapters are not available. The user can explicitly select it in the config if needed.

const url = 'https://httpbin.org/post';

const form = new FormData();
form.append('foo', '123');

const {data} = await axios.post(url, form, {
   adapter: 'fetch',
   params: {
      foo: 1,
      bar: 2
   },
   onUploadProgress(e) {
      console.log('Upload:', e);
   },
   onDownloadProgress(e) {
      console.log('Download:', e);
   }
});

� Conflicts:
�	package-lock.json
�	package.json
@DigitalBrainJS DigitalBrainJS marked this pull request as draft April 27, 2024 22:30
test/unit/adapters/fetch.js Dismissed Show dismissed Hide dismissed
lib/helpers/resolveConfig.js Fixed Show fixed Hide fixed
test/unit/adapters/fetch.js Dismissed Show dismissed Hide dismissed
@DigitalBrainJS DigitalBrainJS marked this pull request as ready for review April 28, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant