JohnnyCrazy / SpotifyAPI-NET

:sound: A Client for the Spotify Web API, written in C#/.NET
http://johnnycrazy.github.io/SpotifyAPI-NET/
MIT License
1.47k stars 299 forks source link

BUG: PlaylistClient.ReplaceItems() checking for HttpStatusCode.Created when Spotify returns HttpStatusCode.OK #972

Open goldfish1974 opened 1 month ago

goldfish1974 commented 1 month ago

When using PlayListClient.ReplaceItems(playlist.Id, new PlaylistReplaceItemsRequest(uris),

the return code from the ReplaceItems returns false when the HttpResponse is OK from the Spotify endpoint. In the code, it makes the assumption that calling ReplaceItems returns created whereas the documentation, and in practice it returns OK.

As a result, you cannot trust the return value but must resort to looking at SpotifyClient.LastResponse.StatusCode.

The bug is here:

and the Spotify Documentation for the value return values is here:

To fix the issue, most likely the line mentioning where the bug is just needs to be updated to OK.

JohnnyCrazy commented 1 month ago

Hey,

Indeed, that endpoint should also return a snapshot response. Might be able to fix this on the weekend, happy to accept PRs too before that!