fix: preserve original query params across paginated Collection reque…#494
Draft
sagar-okta wants to merge 1 commit into
Draft
fix: preserve original query params across paginated Collection reque…#494sagar-okta wants to merge 1 commit into
sagar-okta wants to merge 1 commit into
Conversation
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #439
When iterating a paginated
Collectionbuilt from a request that carriesrequest-shaping query parameters (e.g.
expand=useronlistApplicationUsers), the parameters are applied only to the first page.The Okta API does not echo
expandback in theLink: rel="next"URL, sosubsequent page requests are missing those params and return unexpanded
data.
What is the new behavior?
Collectionnow captures the query parameters from the initial request URIand merges any that are absent from the paginated
nextURL back in beforeissuing the next request. Parameters present in the
nextURL (likepagination cursors
after/before) take precedence, so cursor-drivenpagination is unaffected. This restores
expand, and any similarly-droppedrequest-shaping params, across all pages.
Does this PR introduce a breaking change?
Other information
Added two regression tests in
test/unit/collection.js:expand=userfrom the initial URI is carried into the secondpage request when the server's
nextlink omits itnextlink still wins for overlapping keys (e.g.the pagination cursor
after)Reviewers