fix(http): keep = encoded in HttpParams keys#69884
Open
arshsmith1 wants to merge 1 commit into
Open
Conversation
Member
|
That would be a fix for #11058. But it is known to be a breaking change. |
A parameter name containing `=` was emitted unencoded, so the pair re-read as a different name. Restore `=` only when encoding a value, where the first `=` has already delimited the pair. Fixes angular#11058 BREAKING CHANGE: The default `HttpUrlEncodingCodec` now percent-encodes `=` in parameter keys instead of leaving it literal. A key containing `=` serializes as `filter%3Dadmin=true` rather than `filter=admin=true`, so a backend that relied on the old, ambiguous output will see a different query string. Value encoding is unchanged. Applications that need the previous behaviour can supply a custom `HttpParameterCodec`.
arshsmith1
force-pushed
the
http-params-key-equals
branch
from
July 22, 2026 13:01
519e29c to
2e3a089
Compare
Contributor
Author
|
You're right, and I had it mislabelled. I've re-marked the PR as breaking and amended the commit with a The blast radius is narrow: only keys that actually contain |
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: #11058
HttpUrlEncodingCodec.encodeKeyandencodeValueinpackages/common/http/src/params.tssharestandardEncoding, which runsencodeURIComponentand then restores the characters listed inSTANDARD_ENCODING_REPLACEMENTS. That list includes=, butparamParsersplits every pair at its first=, so a parameter name containing one is written out unencoded and reads back as a different name.new HttpParams().set('filter=admin', 'true').toString()givesfilter=admin=true, which reparses as keyfilterwith valueadmin=true, soHttpParamsdoes not round-trip through its own parser. The gap matters wherever the name is not a literal, for exampleparams.set(facetNameFromApi, value)or params rebuilt fromlocation.search: the request then carries a parameter the caller never asked for.&is already left encoded, so this shifts the key/value boundary rather than adding a whole pair.What is the new behavior?
=is restored only when encoding a value, where the pair has already been delimited and the character is unambiguous. Keys keep it percent-encoded, so the example above serializes asfilter%3Dadmin=trueand reparses to the key it started from. Value encoding is unchanged, including the existingd=eq=1expectation.Does this PR introduce a breaking change?
The serialized output changes for any key that contains
=:filter=admin=truebecomesfilter%3Dadmin=true. A backend that was reading the old, ambiguous output will see a different query string, so this needs to ride a major. The commit message carries aBREAKING CHANGE:footer describing it.Other information
A custom
HttpParameterCodecis unaffected; only the default codec changes, and applications that want the old output can supply their own codec.