Skip to content

fix: preserve original query params across paginated Collection reque…#494

Draft
sagar-okta wants to merge 1 commit into
masterfrom
fix/issue-439
Draft

fix: preserve original query params across paginated Collection reque…#494
sagar-okta wants to merge 1 commit into
masterfrom
fix/issue-439

Conversation

@sagar-okta

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Adding Tests
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #439

When iterating a paginated Collection built from a request that carries
request-shaping query parameters (e.g. expand=user on
listApplicationUsers), the parameters are applied only to the first page.
The Okta API does not echo expand back in the Link: rel="next" URL, so
subsequent page requests are missing those params and return unexpanded
data.

What is the new behavior?

Collection now captures the query parameters from the initial request URI
and merges any that are absent from the paginated next URL back in before
issuing the next request. Parameters present in the next URL (like
pagination cursors after / before) take precedence, so cursor-driven
pagination is unaffected. This restores expand, and any similarly-dropped
request-shaping params, across all pages.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Added two regression tests in test/unit/collection.js:

  • verifies expand=user from the initial URI is carried into the second
    page request when the server's next link omits it
  • verifies the server's next link still wins for overlapping keys (e.g.
    the pagination cursor after)

Reviewers

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.

1 participant