Error "Payload is set but no content-type header specified" when calling play()
See original GitHub issueDescribe the bug
I’m seeing an issue where when I call play()
without any parameters, I get an exception with the error message “Payload is set but no content-type header specified”.
To Reproduce
This reproduces every time I call play()
. I am using React Native and reproducing this on an Android phone. Interestingly, I’m only seeing this for play()
but not pause()
. I also have another project that uses React (instead of React Native) and runs in desktop Chrome and am not observing this issue.
Additional context Below is the full response returned by Spotify:
{
"UNSENT": 0,
"OPENED": 1,
"HEADERS_RECEIVED": 2,
"LOADING": 3,
"DONE": 4,
"readyState": 4,
"status": 0,
"timeout": 0,
"withCredentials": true,
"upload": {},
"_aborted": false,
"_hasError": true,
"_method": "PUT",
"_response": "Payload is set but no content-type header specified",
"_url": "https://api.spotify.com/v1/me/player/play",
"_timedOut": false,
"_trackingName": "unknown",
"_incrementalEvents": false,
"_requestId": null,
"_headers": {
"authorization": "Bearer BQD1k6iCo2ITQdQTzX6VfGmYwGdeK7rAoAufwi4YDUzJI2EFnENC-q_Z1x2QljnT0TooLJbHUQMn_vKYv5zwig_4ZRWBdboZpFRZ8FuocHBcLMEp-ib-7Ia1r3c8Q87H3Jwu30Hr8ZUr2fOlnx77_w9c2bLIQAAcQW8"
},
"_responseType": "",
"_sent": true,
"_lowerCaseResponseHeaders": {},
"_subscriptions": []
}
After some trial and error, I discovered that if I remove the line postData: postData
from request.Data
in play()
, things will work fine:
Despite the workaround, I’m still interested in getting to the bottom of this, and hopefully fix it in a non-hacky way if possible.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Hi @quentin-sommer, you’re right! I have just published 1.5.1
Thanks a lot