mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Do not clear queryParams UriComponentsBuilder#query
See gh-35628 Signed-off-by: Schäfer, H.H. (Hans Hosea) <HansHosea.Schaefer@ing.de>
This commit is contained in:
committed by
rstoyanchev
parent
1c2a24a8ed
commit
649bd3ee2d
@@ -477,6 +477,24 @@ class UriComponentsBuilderTests {
|
||||
assertThat(result.toUriString()).isEqualTo("https://www.ietf.org");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource
|
||||
void query(final ParserType parserType) {
|
||||
final UriComponents uriComponents = UriComponentsBuilder.fromUriString("https://example.com/foo?foo=bar", parserType)
|
||||
.query("baz=qux")
|
||||
.build();
|
||||
assertThat(uriComponents.getQueryParams()).isEqualTo(Map.of("foo", List.of("bar"), "baz", List.of("qux")));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource
|
||||
void queryWithNullDoesRetainQueryParameters(final ParserType parserType) {
|
||||
final UriComponents uriComponents = UriComponentsBuilder.fromUriString("https://example.com/foo?foo=bar", parserType)
|
||||
.query(null)
|
||||
.build();
|
||||
assertThat(uriComponents.getQueryParams()).isEqualTo(Map.of("foo", List.of("bar")));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource
|
||||
void replaceQuery(ParserType parserType) {
|
||||
|
||||
Reference in New Issue
Block a user