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

fix(auth): ensure to set proper "Content-Type" HTTP request header #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leonklingele
Copy link

When not specifying a "data" property for HTTP requests, Axios uses a "Content-Type: application/json" header, even if another "Content-Type" header was specified. This makes these requests to the Spotify API fail with a response status of 400 and a response body of

{"error":"server_error"}

This change sets an empty "data" property to make Axios send the "Content-Type: application/x-www-form-urlencoded" header as expected.

I spent quite a bit of time on debugging this, until I found spotify/web-api#449 (comment)

When not specifying a "data" property for HTTP requests, Axios
uses a "Content-Type: application/json" header, even if another
"Content-Type" header was specified. This makes these requests
to the Spotify API fail with a response status of 400 and a response
body of

	{"error":"server_error"}

This change sets an empty "data" property to make Axios send the
"Content-Type: application/x-www-form-urlencoded" header as expected.

I spent quite a bit of time on debugging this, until I found
spotify/web-api#449 (comment)
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

Successfully merging this pull request may close these issues.

1 participant