Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates "link" header access in populatePageCursor to be case-insensitive #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dbrudner
Copy link

@dbrudner dbrudner commented Oct 8, 2020

Recurly's API recently updated the casing of some response headers. While this doesn't affect this client library at all right now, there is no guarantee that any response header's casing will be the same going forward.

The only header that's accessed in a case-sensitive manner is the "Link" header in the populatePageCursor function. Right now, this works fine, as the "Link" response header hasn't been changed, but this isn't guaranteed to stay this way in the future (see HTTP 1.1 RFC 2616, which states that "field-names are case insensitive" for more info on this).

I'd be happy to add an assertion for this as well if it's helpful! Please feel free to respond in the PR or reach out if you have any questions, concerns, or anything at all.

@dbrudner dbrudner changed the title Fix "link" header access in populatePageCursor to be case-insensitive Updates "link" header access in populatePageCursor to be case-insensitive Oct 9, 2020
Copy link
Member

@cristiangraz cristiangraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching and contributing! Two quick changes below.

recurly.go Outdated
if !ok || len(links) == 0 {
links := r.Response.Header.Get("Link")

if len(links) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to keep consistent with the library's styling, please move this up a line and use if links != "" {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants