Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix TS definition for AxiosRequestTransformer - #4201

#4201
Merged
jasonsaayman merged 2 commits into
axios:masteraxios/axios:masterfrom
brianhelba:patch-1brianhelba/axios:patch-1Copy head branch name to clipboard
May 4, 2022
Merged

Fix TS definition for AxiosRequestTransformer#4201
jasonsaayman merged 2 commits into
axios:masteraxios/axios:masterfrom
brianhelba:patch-1brianhelba/axios:patch-1Copy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.