[GH-ISSUE #301] cursors in rspotify_model::page::CursorBasedPage can be None #91

Closed
opened 2026-02-27 20:23:04 +03:00 by kerem · 1 comment
Owner

Originally created by @aome510 on GitHub (Mar 6, 2022).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/301

Describe the bug
The cursors field in the cursor-based page object can be null if the page returned by the request is empty. Assuming it is non-nullable makes deserializing the response object panic.

To Reproduce
Steps to reproduce the behavior:

  1. Make a get-recently-played request
curl --request GET \
     --url 'https://api.spotify.com/v1/me/player/recently-played?before=<random number, e.g 100>' \
     --header 'Authorization: Bearer <TOKEN> \
     --header 'Content-Type: application/json'

Expected behavior
Found the cursors field in the response to be null.

Originally created by @aome510 on GitHub (Mar 6, 2022). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/301 **Describe the bug** The `cursors` field in the cursor-based page object can be null if the page returned by the request is empty. Assuming it is non-nullable makes deserializing the response object panic. **To Reproduce** Steps to reproduce the behavior: 1. Make a [get-recently-played](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recently-played) request ``` curl --request GET \ --url 'https://api.spotify.com/v1/me/player/recently-played?before=<random number, e.g 100>' \ --header 'Authorization: Bearer <TOKEN> \ --header 'Content-Type: application/json' ``` **Expected behavior** Found the `cursors` field in the response to be null.
kerem 2026-02-27 20:23:04 +03:00
Author
Owner

@marioortizmanero commented on GitHub (Mar 7, 2022):

Can confirm that I can reproduce this:

 curl --request GET \
     --url 'https://api.spotify.com/v1/me/player/recently-played?before=100' \
     --header "Authorization: Bearer $ACCESS_TOKEN" \
     --header 'Content-Type: application/json'
{
  "items" : [ ],
  "next" : null,
  "cursors" : null,
  "limit" : 20,
  "href" : "https://api.spotify.com/v1/me/player/recently-played?before=100"
}
<!-- gh-comment-id:1060624324 --> @marioortizmanero commented on GitHub (Mar 7, 2022): Can confirm that I can reproduce this: ``` curl --request GET \ --url 'https://api.spotify.com/v1/me/player/recently-played?before=100' \ --header "Authorization: Bearer $ACCESS_TOKEN" \ --header 'Content-Type: application/json' { "items" : [ ], "next" : null, "cursors" : null, "limit" : 20, "href" : "https://api.spotify.com/v1/me/player/recently-played?before=100" } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#91
No description provided.