Closed diamondo25 closed 5 years ago
Thanks for pointing this out. I don't see any action necessary here, so I'll close the issue.
@zmb3, should this not at least be documented? We could also make it return a self defined error for this that's more readable (to compare with.)
The API returns a 204 for this request without body, so we can check for that response code and return a ErrNoPlayerCurrentlyPlaying
or something.
Looks like current implementation doesn't allow to do this easily, I'll try and figure something out.
Should be able to just update spotify/Client.execute()
to skip reading the response body in the event of a 204.
Something like this, for example:
if result != nil && resp.Status != http.StatusNoContent {
if err := json.NewDecoder(resp.Body).Decode(result); err != nil {
return err
}
}
Sometimes, when there's no player registered (I suppose), the API returns an EOF. The token is correct and the error can be ignored.