spotify-player
spotify-player copied to clipboard
Spotify API can return with a `204 NO CONTENT` response if no song is playing
According to the docs, the Spotify API:
When no track is currently playing, the request will return a 204 NO CONTENT response with no payload.
This will cause this line to error out since an empty string is not a valid JSON string.
This promise should return a null or empty dict if the Spotify API returns with a 204 NO CONTENT response.
https://github.com/JMPerez/spotify-player/blob/ef57833cb07bff148f612e2cedef99b8ae55a8ff/public/spotify-player.js#L161
This causes the logout() method to be called automatically, which is not always the wanted behavior.