Fix pagination beyond page 2#29
Merged
ChristopherDavenport merged 1 commit intodavenverse:masterfrom Oct 15, 2019
Merged
Conversation
Collaborator
|
Lets get an issue on http4s, and make sure we're handling this where most appropriate and then coping with it here in the process. |
| val req = auth.fold(baseReq)(setAuth(_)(baseReq)) | ||
| c.run(req).use{resp => | ||
| resp.as[B].map{ | ||
| c.fetch(req) { resp => |
Collaborator
There was a problem hiding this comment.
Why did we switch from run to fetch. run is clearer use semantics in my opinion.
Contributor
Author
There was a problem hiding this comment.
No clear reason - I just didn't know how to do it using f.
But looking at it now, I think it should also work using use as well.
I guess this part can be changed back - I can do it if you want.
Collaborator
|
I think this may be caught by http4s/http4s#2967 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the process of changing
Search.repositoriesto be paginated (#30) I noticed that I never get results beyond page 2.I discovered that the
Linkheader contains multiple links separated by,in one header line.For example
wiill return
On the first page it works, because the first header there is the
rel="next"link.To fix it, I rewrote the logic for
getNextUri.The spec (page 5) seems to indicate this is not a standard, but it appears in the examples (page 9). So maybe it should be fixed ustream in http4s. I'd like to hear your thoughts on that.
While fixing the above I also noticed that
runPaginatedRequestseemed to ignore invalid HTTP status codes. This change is kind of optional because the parsing of the response will later fail anyway, but I think it's a bit nicer to check the status code of the response first and the error message is much clearer.