提交 e8dd35ce 编写于 作者: A Arjen Poutsma

Added check for expanding already encoded UriComponents object

上级 8337f4bf
......@@ -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);
......
......@@ -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");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册