Refactored axios headers helpers to the AxiosHeaders class;#4753
Closed
DigitalBrainJS wants to merge 7 commits intoaxios:mainfrom
Closed
Refactored axios headers helpers to the AxiosHeaders class;#4753DigitalBrainJS wants to merge 7 commits intoaxios:mainfrom
DigitalBrainJS wants to merge 7 commits intoaxios:mainfrom
Conversation
…osHeaders � Conflicts: � lib/core/dispatchRequest.js
Refactored accessor building routine; Refactored default transforms; Removed `normalizeHeaderName` helper;
Added missed `has` accessor to TS types;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
transformDatahelper;dispatchRequestNow the headers object has Map-like methods:
Using these methods guarantees caseless work with headers. The original header case will be preserved.
At the same time, the headers can still be manipulated directly - they will be normalized after each iteration of the data transformation.
The 'Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent' headers have accessors:
Output:
My header value1 AxiosHeaders { date: 'Sat, 28 May 2022 14:26:23 GMT', 'content-type': 'application/json', 'content-length': '463', connection: 'close', server: 'gunicorn/19.9.0', 'access-control-allow-origin': '*', 'access-control-allow-credentials': 'true', [Symbol(defaults)]: null } Content Length (direct access): 463 Content Length: 463 Has server header: true Is gunicorn server: true Gunicorn version: 19.9.0