Description
Describe the bug
Recently in #305 a method has been added to return null when the Spotify API returns a 204 status. I found out that the library keeps retrying when it has found a 204 status code, instead of plainly returning null.
In the execute()
method in the Endpoints.kt
file, at line 134, we see that the API delegates the response handling (handleResponse
), but also defaults to executing the method again when the result of that response handling is null. In the recent issue, a check has been added to the handleResponse()
method which will return null if the status code is 204. This, however, triggers a retry due to the handleResponse(bla bla ..) ?: execute(bla bla ..)
.
To Reproduce
Steps to reproduce the behavior:
- Make sure to not use Spotify for a while, the 204 will occur if Spotify detects that you are not using it for a period of time
- Use the getCurrentContext method (
spotifyClientAPI?.player?.getCurrentContext()
to get the current playback state - Setting breakpoints in the execute method of
Endpoints.kt
, you'll notice the retries
Expected behavior
Execute method should just return null instead of continously retry
Desktop (please complete the following information):
- OS: Windows
- Browser Edge
Smartphone (please complete the following information):
- Device: S22+
- OS: Android 12