Closed Nielssg closed 2 years ago
This is going to be an interesting problem, thanks for reporting. The correct behavior should be to return null and this should be handled in Endpoint. I will investigate what specifically needs to change
Endpoints.execute
should return null with code 204. Nullable request methods will be created as-needed (we just need a get for this)
Describe the bug If you try to get the current player context, but the user is not playing anything for some time, the API will respond with a HTTP 204 status (API doc). The problem is that this library expects to parse its response, which does not exist because of the 204 status
To Reproduce Steps to reproduce the behavior: Use the getCurrentContext endpoint to retrieve the player state (
spotifyClientAPI?.player?.getCurrentContext()
) when you don't have Spotify open or haven't played for a while. It will return status 204 with an empty body. The full url which will be called by default is https://api.spotify.com/v1/me/player?additional_types=track%2Cepisode`Expected behavior That's actually a good question, normally you would expect some kind of result, maybe return null of something to indicate that it cannot be retrieved.
Additional context Error log: