Conversation
Collaborator
|
FYI don't PR to |
Collaborator
Author
It is a WIP for John to view. It can be rebased. And without being told in advance where to open a PR I have little choice! |
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.
This fixes the next/prev issue outlined below and the modified tests pass. But I'm not 100% I understand what is going on. In the tests the mock requests are made without a format type, but
JSONis returned. As ifJSONis the default format. But when using the API if no format is givenHTMLis returned, as ifHTMLis the default. I have not managed to track through the code to see why there is this mismatch.I have modified the mocks to ask for JSON and the code to use the format in the next/prev links. So It works, but whether it is correct to what they think should be happening is another thing!
I will leave this PR as WIP.
Background
If you make a call to our current ogcapi asking for JSON data with and offset and limit:
https://ogcapi.bgs.ac.uk/collections/recentearthquakes/items?f=json&offset=100&limit=100
And scroll down to the links at the bottom, the
nextandprevlinks don't have a format specified. The same applies for an impliedoffsetof zero.This means that they return HTML pages not JSON data, as they should.
I am not convinced about the
selforalternatelinks either since they fail to include the offset:The
selflink should make exactly the same call and the twoalternates, in my view, should also include theoffset.