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

Remove unnecessary checks in default transformRequest #4202

Closed
wants to merge 1 commit into from

Conversation

brianhelba
Copy link
Contributor

transformRequest callbacks can always expect their 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
);

Accordingly, checking whether headers is undefined is unnecessary.

This is related to #4201.

`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, seems to have already been solved by another pull request

@brianhelba brianhelba deleted the patch-2 branch May 7, 2022 16:30
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