mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-03 05:19:07 +00:00
Added check for expanding already encoded UriComponents object
This commit is contained in:
@@ -336,6 +336,8 @@ public final class UriComponents {
|
||||
}
|
||||
|
||||
private UriComponents expandInternal(UriTemplateVariables uriVariables) {
|
||||
Assert.state(!encoded, "Cannot expand an already encoded UriComponents object");
|
||||
|
||||
String expandedScheme = expandUriComponent(this.scheme, uriVariables);
|
||||
String expandedUserInfo = expandUriComponent(this.userInfo, uriVariables);
|
||||
String expandedHost = expandUriComponent(this.host, uriVariables);
|
||||
|
||||
+5
@@ -54,4 +54,9 @@ public class UriComponentsTests {
|
||||
assertEquals("http://example.com/1 2 3 4", uriComponents.toUriString());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void expandEncoded() {
|
||||
UriComponentsBuilder.fromPath("/{foo}").build().encode().expand("bar");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user