Skip to content

Fixed & Imporoved AxiosHeaders class#5224

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

Fixed & Imporoved AxiosHeaders class#5224
jasonsaayman merged 4 commits intoaxios:v1.xfrom
DigitalBrainJS:feat/axios-headers

Conversation

@DigitalBrainJS
Copy link
Collaborator

@DigitalBrainJS DigitalBrainJS commented Nov 3, 2022

(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
Copy link

fdrobidoux commented Nov 4, 2022

I need this badly. Can this be approved please?

@coawazie
Copy link

coawazie commented Nov 4, 2022

Also watching for the merge of this!

@tm1000
Copy link

tm1000 commented Nov 10, 2022

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

5 participants