Skip to content

Refactored AxiosHeaders class to fix #5067; - #5169

Closed
DigitalBrainJS wants to merge 2 commits into
axios:v1.xfrom
DigitalBrainJS:feat/axios-headers
Closed

DigitalBrainJS wants to merge 2 commits into
axios:v1.xfrom
DigitalBrainJS:feat/axios-headers

Conversation

@DigitalBrainJS

@DigitalBrainJS DigitalBrainJS commented Oct 20, 2022 •

Copy link
Copy Markdown
Collaborator

This PR has potential breaking changes in AxiosHeaders class.

const headersA = new AxiosHeaders({x:1});
const headersB = headersA.concat({y:2}, {z:3}, 'foo: 1\nbar: 2');
const headersC = AxiosHeaders.concat({x:1}, {y:2}, {z:3})
  • set method (as well as the class constructor) now accepts a AxiosHeaders instance and raw headers string as the source
  • added instance iterator to iterate over resolved headers
  • added toString to serialize into a raw headers string
  • default content type now is undefined, not application/x-www-form-urlencoded. This step makes it easier to keep track of user-defined header values, which in turn simplifies the implementation of the AxiosHeaders class. However, the content header will still be added before the request is sent if it is not explicitly defined or disabled by the user. Only the place and method of adding this header inside the Axios have been changed.

Closes #5157;
Closes #5067;
Closes #5006;

@luisdeka

luisdeka commented Nov 1, 2022

Copy link
Copy Markdown

need this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants