4.x: Fix resolved URI query params (#8566) #8614
Open
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
The
ClientRequestBase
class did not properly resolve URIs when path- and query parameters were mixed. More specifically, the query parameters were stripped if the URI template was absolute.The reason for this is that
ClientRequestBase.resolveUri
first resolves path parameters (creating aURI
instance) and then callsClientRequestBase.resolve
against thatURI
. If the constructedURI
is absolute, resolving against it clears query parameters.Note that there are two
ClientRequestBase.resolve
methods: one forURI
s and one forClientUri
s. They behave differently regarding query parameters. The former mimics whatURI.resolve
does, which returns its argument if it is absolute; in particular, it removes any existing query parameters from theClientUri
if the argument is absolute. The latter method, however, leaves query parameters untouched. I'm not sure this difference is intentional but since these are public methods, their semantics shouldn't be changed. I added tests for this.Resolves #8566