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

Fixing instance.defaults.headers type #4557

Merged
merged 5 commits into from May 9, 2022

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Mar 29, 2022

When creating an Axios instance with Axios.create() the headers config (as described in the README) is merged into the root of instance.default.headers. These values are not accessible because the types for instance.defaults.headers do not include an index type to represent the arbitrary properties which are merged there.

This PR includes this index type in the instance.defaults.headers object and includes validation that this works in the test/typescript/axios.ts file. Without the change in index.d.ts this test shows the following error:

image

@jasonsaayman jasonsaayman merged commit 9f6ba5e into axios:master May 9, 2022
@jasonsaayman
Copy link
Member

Thanks for the contribution 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants