Skip to content

Fix TS definition for AxiosRequestTransformer#4201

Merged
jasonsaayman merged 2 commits intoaxios:masterfrom
brianhelba:patch-1
May 4, 2022
Merged

Fix TS definition for AxiosRequestTransformer#4201
jasonsaayman merged 2 commits intoaxios:masterfrom
brianhelba:patch-1

Conversation

@brianhelba
Copy link
Copy Markdown
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
Copy Markdown
Member

Thanks for the contribution

@jasonsaayman jasonsaayman merged commit eaaab30 into axios:master May 4, 2022
@brianhelba brianhelba deleted the patch-1 branch April 10, 2023 18:39
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.

2 participants