Browse Source

fix (URI components) test

- fix MockHttpServletRequestBuilderTests#queryParameterWithoutValues

Signed-off-by: Fabrice Bibonne <fabrice.bibonne@gmail.com>
pull/35658/head
Fabrice Bibonne 2 months ago
parent
commit
8a1a56a774
  1. 9
      spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

9
spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

@ -625,7 +625,14 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
} }
private void addAllToQueryParams(MultiValueMap<String, String> params) { private void addAllToQueryParams(MultiValueMap<String, String> params) {
params.forEach((key, values) -> values.forEach(v -> this.queryParam(key, v))); params.forEach((key, values) -> {
if (values.isEmpty()) {
this.queryParams.add(new HierarchicalUriComponents.QueryParam(key, null));
}
else{
values.forEach(v -> this.queryParams.add(new HierarchicalUriComponents.QueryParam(key, v)));
}
});
} }
@Override @Override

Loading…
Cancel
Save