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

Removing/overriding default headers #19

Open
viguan opened this issue Apr 5, 2019 · 1 comment
Open

Removing/overriding default headers #19

viguan opened this issue Apr 5, 2019 · 1 comment

Comments

@viguan
Copy link

viguan commented Apr 5, 2019

Following the example for Headers in the readme:

let headers = Axios.Headers.fromDict(headersDict);
Axios.getc("https://example.com", Axios.makeConfig(~headers, ()));

I noticed that Axios appends default headers, like Accept: application/json, text/plain, */*. The service I am trying to connect with doesn't accept the Accept headers, and throws me a 406 -- Not Acceptable error.

Also, when I set the header dict like dict.set("accept", "*/*"), I noticed that the Accept header value gets appended with */* instead of being replace. The Accept header ultimately looks like:
Accept: application/json, text/plain, */*, */*.

I noticed that there is a way to remove the default header for the js library:
https://stackoverflow.com/questions/46656474/axios-remove-headers-authorization-in-1-call-only

Is there a way to remove default headers? Or override them?

@viguan viguan changed the title Removing default headers Removing/overriding default headers Apr 5, 2019
@meafmira
Copy link
Owner

Hello. Thank you for issue. I'll try to fix it soon

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

No branches or pull requests

2 participants