Skip to content

Fixed & Imporoved AxiosHeaders class - #5224

Merged
jasonsaayman merged 4 commits into
axios:v1.xfrom
DigitalBrainJS:feat/axios-headers
Nov 7, 2022
Merged

jasonsaayman merged 4 commits into
axios:v1.xfrom
DigitalBrainJS:feat/axios-headers

Conversation

@DigitalBrainJS

@DigitalBrainJS DigitalBrainJS commented Nov 3, 2022 •

Copy link
Copy Markdown
Collaborator

(This is just a copy of #5169 that was closed automatically by mistake due to referencing from another PR)

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, simplifying 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.
  • AxiosHeaders instance can be used as a header option value;
  • config header merging is now caseless;

Closes #5157;
Closes #5067;
Closes #5006;
Closes #5226;
Closes #4998;

@@ -1,3 +1,5 @@
import AxiosHeaders from "../../lib/core/AxiosHeaders.js";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class

Unused import AxiosHeaders.
@fdrobidoux

fdrobidoux commented Nov 4, 2022 •

Copy link
Copy Markdown

I need this badly. Can this be approved please?

@coawazie

coawazie commented Nov 4, 2022

Copy link
Copy Markdown

Also watching for the merge of this!

@tm1000

tm1000 commented Nov 10, 2022

Copy link
Copy Markdown

Can a release be issued for 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

6 participants