feat: add immutable URI query replacement helpers#10268
Open
memleakd wants to merge 1 commit into
Open
Conversation
- add immutable URI helpers for replacing and filtering query vars - document the full immutable query helper family - cover clone behavior, raw query strings, fragments, and invalid query strings Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
URI query replacement helpers
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.
Description
This PR follows up on the recently added
URI::withQueryVar()/withQueryVars()helpers by adding the remaining immutable query helpers for the existing mutable query APIs:Each method returns a cloned URI and leaves the original instance unchanged.
The naming follows the direction discussed in #10242:
setQuery()->withQuery()setQueryArray()->withQueryArray()stripQuery()->withoutQueryVars()keepQuery()->withOnlyQueryVars()I kept
withQueryParams()out of this because PSR-7 uses that name onServerRequestInterface, notUriInterface, andwithQueryArray()keeps the URI-side API clearer.Tests cover cloning behavior, query replacement, raw query strings, fragments, filtering/removal, and invalid query strings.
Checklist: