Skip to content

Case-sensitive comparison of HTTP header string causes resp_link_url() to fail and can break response pagination #654

@DavidRLovell

Description

@DavidRLovell

I think I may have found a problem in resp_link_url() at line 177:

link_headers <- headers[names(headers) == "Link"]

Here's why I think there is an issue

  • I had been successfully retrieving paginated responses from the Canvas Learning Management System via their API
  • Today, I noticed that I was only getting the first 100 elements of a request that had (last year) been returning 184
    • The request relates to a class I teach and I have been on a break... writing an R package to access Canvas using httr2
  • The Pagination page of the Canvas API documentation notes:

Because HTTP header names are case-insensitive, please be sure you are not parsing the Link header in a case-sensitive way. The capitalization of the header name is not guaranteed.

link_headers <- headers[tolower(names(headers)) == "link"]
  • Seeing that resp_header_exists() does case-insensitve comparison lends weight to the idea that there is a problem.

@hadley: I think this may have happened here perhaps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions