spotify-api.js
spotify-api.js copied to clipboard
fix(auth): ensure to set proper "Content-Type" HTTP request header
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 https://github.com/spotify/web-api/issues/449#issuecomment-312677019
thanks for the fix @leonklingele ,it works perfectly !
would it be possible to merge this PR @scientific-dev ?