Test for non-equality after URI normalization
Issue: SPR-16364
This commit is contained in:
parent
347c2daa2c
commit
93f645800b
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -215,7 +215,7 @@ public class UriComponentsBuilderTests {
|
|||
}
|
||||
|
||||
@Test // SPR-10539
|
||||
public void fromUriStringIPv6Host() throws URISyntaxException {
|
||||
public void fromUriStringIPv6Host() {
|
||||
UriComponents result = UriComponentsBuilder
|
||||
.fromUriString("http://[1abc:2abc:3abc::5ABC:6abc]:8080/resource").build().encode();
|
||||
assertEquals("[1abc:2abc:3abc::5ABC:6abc]", result.getHost());
|
||||
|
@ -239,7 +239,7 @@ public class UriComponentsBuilderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void fromHttpRequest() throws URISyntaxException {
|
||||
public void fromHttpRequest() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setScheme("http");
|
||||
request.setServerName("localhost");
|
||||
|
@ -275,7 +275,7 @@ public class UriComponentsBuilderTests {
|
|||
assertEquals("/rest/mobile/users/1", result.getPath());
|
||||
}
|
||||
|
||||
@Test //SPR-14761
|
||||
@Test // SPR-14761
|
||||
public void fromHttpRequestWithForwardedIPv4Host() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setScheme("http");
|
||||
|
@ -290,7 +290,7 @@ public class UriComponentsBuilderTests {
|
|||
assertEquals("http://192.168.0.1/mvc-showcase", result.toString());
|
||||
}
|
||||
|
||||
@Test //SPR-14761
|
||||
@Test // SPR-14761
|
||||
public void fromHttpRequestWithForwardedIPv6() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setScheme("http");
|
||||
|
@ -305,7 +305,7 @@ public class UriComponentsBuilderTests {
|
|||
assertEquals("http://[1abc:2abc:3abc::5ABC:6abc]/mvc-showcase", result.toString());
|
||||
}
|
||||
|
||||
@Test //SPR-14761
|
||||
@Test // SPR-14761
|
||||
public void fromHttpRequestWithForwardedIPv6Host() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setScheme("http");
|
||||
|
@ -320,7 +320,7 @@ public class UriComponentsBuilderTests {
|
|||
assertEquals("http://[1abc:2abc:3abc::5ABC:6abc]/mvc-showcase", result.toString());
|
||||
}
|
||||
|
||||
@Test //SPR-14761
|
||||
@Test // SPR-14761
|
||||
public void fromHttpRequestWithForwardedIPv6HostAndPort() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setScheme("http");
|
||||
|
@ -335,7 +335,6 @@ public class UriComponentsBuilderTests {
|
|||
assertEquals("http://[1abc:2abc:3abc::5ABC:6abc]:8080/mvc-showcase", result.toString());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void fromHttpRequestWithForwardedHost() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
@ -900,4 +899,14 @@ public class UriComponentsBuilderTests {
|
|||
assertEquals(-1, result.getPort());
|
||||
assertEquals("https://example.com/rest/mobile/users/1", result.toUriString());
|
||||
}
|
||||
|
||||
@Test // SPR-16364
|
||||
public void uriComponentsNotEqualAfterNormalization() {
|
||||
UriComponents uri1 = UriComponentsBuilder.fromUriString("http://test.com").build().normalize();
|
||||
UriComponents uri2 = UriComponentsBuilder.fromUriString("http://test.com/").build();
|
||||
assertTrue(uri1.getPathSegments().isEmpty());
|
||||
assertTrue(uri2.getPathSegments().isEmpty());
|
||||
assertNotEquals(uri1, uri2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue