Merged
Conversation
|
Does this change apply to defaults as well, like:
|
Collaborator
Author
|
Yes, the adapter is resolved right before its call. |
Contributor
|
Is that possible to export method import axios, { getAdapter } from 'axios';
const defaultAdapters = axios.defaults.adapter;
axios.defaults.adapter = (config) => {
// do something
const adapter = getAdapter(defaultAdapters);
adapter(config);
// do something
} |
depoulo
added a commit
to depoulo/nock
that referenced
this pull request
Apr 17, 2023
This was added with nock#1711 but [has changed with axios v1](axios/axios#5277)
mastermatt
pushed a commit
to nock/nock
that referenced
this pull request
Apr 26, 2023
* fix(README): Update axios example This was added with #1711 but [has changed with axios v1](axios/axios#5277)
I want to do adapter enhancement, why not expose the adapter |
bmulholland
pushed a commit
to gitify-app/gitify
that referenced
this pull request
Oct 2, 2023
bmulholland
pushed a commit
to gitify-app/gitify
that referenced
this pull request
Oct 3, 2023
1 task
bmulholland
pushed a commit
to gitify-app/gitify
that referenced
this pull request
Oct 4, 2023
* fix(deps): update dependency axios to v1 * Use new adapter setting See axios/axios#5277 * Fix tests * Remove unnecessary transform --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Brendan Mulholland <brendan@recital.software>
afonsojramos
added a commit
to gitify-app/gitify
that referenced
this pull request
Oct 24, 2023
* fix(deps): update dependency axios to v1 * Use new adapter setting See axios/axios#5277 * Fix tests * Remove unnecessary transform * chore(deps): Remove history dependency * chore: update tests to remove `history` --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com>
MrChuckomo
added a commit
to MrChuckomo/poddycast
that referenced
this pull request
Nov 21, 2023
Hasan-Mir
reviewed
Jul 13, 2024
|
|
||
| type Milliseconds = number; | ||
|
|
||
| type AxiosAdapterName = 'xhr' | 'http' | string; |
There was a problem hiding this comment.
why not 'xhr' | 'http' ?
currently it does not provide auto completion in IDEs because of that | string
This was referenced Oct 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now we can set the adapter by name:
We can use auto-select from the list (If the adapter is not supported its handle is set to false and Axios tries to set the next one):
So now the default adapter config is
adapter: ['xhr', 'http'];In the future, when we have more than 2 adapters (fetch, http2, other frameworks/OS), we will be able to make separate builds with the selected adapters, and this adapter loader will deal with this by selecting the next available adapter or throwing an error like:
Closes #5264;
Closes #5263;