Skip to content

Commit 5aa131a

Browse files
committed
Correction for commit #c6e500
Issue: SPR-17630
1 parent ea3017b commit 5aa131a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public URI build(Map<String, ?> uriVariables) {
458458
*/
459459
public String toUriString() {
460460
return this.uriVariables.isEmpty() ?
461-
encode().build().toUriString() :
461+
build().encode().toUriString() :
462462
buildInternal(EncodingHint.ENCODE_TEMPLATE).toUriString();
463463
}
464464

spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java

+5
Original file line numberDiff line numberDiff line change
@@ -919,4 +919,9 @@ public void uriComponentsWithMergedQueryParams() {
919919
assertEquals("http://localhost:8081/{path}?sort={sort}&sort=another_value", uri);
920920
}
921921

922+
@Test // SPR-17630
923+
public void toUriStringWithCurlyBraces() {
924+
assertEquals("/path?q=%7Basa%7Dasa",
925+
UriComponentsBuilder.fromUriString("/path?q={asa}asa").toUriString());
926+
}
922927
}

0 commit comments

Comments
 (0)