Closed as not planned
Description
Query string parameters with equals in the value throw and exception in build method:
@Test
public void equals_in_query_string_value() {
var str = "https://localhost:8080/callback?param1=a%20b¶m2=1=2";
var uri = URI.create(str);
var actual = UriComponentsBuilder.fromUri(uri)
.build(true)
.toUri();
assertEquals(uri, actual);
}
Exception:
java.lang.IllegalArgumentException: Invalid character '=' for QUERY_PARAM in "1=2"
I use true
because the source is already a valid URI and I do not want a doble escape in the param1.
I did not find anything in any standard or convention that says that this character is forbidden, I tried different implementations and they worked as espected: URLSearchParams in any browser, node queryparams, etc.
Expected behaviour:
- Both URIs in the test should be equal.
- No exception should be thrown.
param2
equals1=2
References:
URL (Web API) example:
new URL('https://localhost:8080/callback?param1=a%20b¶m2=1=2').searchParams
URLSearchParams { 'param1' => 'a b', 'param2' => '1=2' }