Fix URI var encoding issue with '$'

When expanding and strictly encoding URI variables, there is no need to
quote `/` and `$` which will be encoded anyway.

Issue: SPR-17168
This commit is contained in:
Rossen Stoyanchev
2018-08-13 11:51:18 +03:00
parent 430065c31d
commit 99f0129711
2 changed files with 13 additions and 8 deletions

View File

@@ -74,6 +74,12 @@ public class UriComponentsTests {
assertEquals("/hotel%20list/Z%C3%BCrich%20specials?q=a%2Bb", uri.expand("a+b").toString());
}
@Test // SPR-17168
public void encodeAndExpandWithDollarSign() {
UriComponents uri = UriComponentsBuilder.fromPath("/path").queryParam("q", "{value}").encode().build();
assertEquals("/path?q=JavaClass%241.class", uri.expand("JavaClass$1.class").toString());
}
@Test
public void toUriEncoded() throws URISyntaxException {
UriComponents uriComponents = UriComponentsBuilder.fromUriString(