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

Fix TS definition for AxiosRequestTransformer #4201

Merged
merged 2 commits into from May 4, 2022

Conversation

brianhelba
Copy link
Contributor

The callback AxiosRequestTransformer can always expect its headers
parameter to be defined. This is ensured immediately before the callback
is made.
See:

config.headers = config.headers || {};
// Transform request data
config.data = transformData.call(
config,
config.data,
config.headers,
config.transformRequest
);

The callback `AxiosRequestTransformer` can always expect its `headers`
parameter to be defined. This is ensured immediately before the callback
is made.
See: https://github.com/axios/axios/blob/1025d1231a7747503188459dd5a6d1effdcea928/lib/core/dispatchRequest.js#L32-L40
brianhelba added a commit to brianhelba/axios that referenced this pull request Oct 19, 2021
`transformRequest` callbacks can always expect their `headers`
parameter to be defined. This is ensured immediately before the callback
is made.
See: https://github.com/axios/axios/blob/1025d1231a7747503188459dd5a6d1effdcea928/lib/core/dispatchRequest.js#L32-L40

Accordingly, checking whether `headers` is `undefined` is unnecessary.

This is related to axios#4201.
@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