spotify-player icon indicating copy to clipboard operation
spotify-player copied to clipboard

Spotify API can return with a `204 NO CONTENT` response if no song is playing

Open Montspy opened this issue 6 years ago • 1 comments

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

Montspy avatar Nov 11 '19 18:11 Montspy

This causes the logout() method to be called automatically, which is not always the wanted behavior.

Montspy avatar Nov 11 '19 18:11 Montspy