Polish URL Cleanup
This commit is contained in:
@@ -141,6 +141,7 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void usesForwardedHostAsHostIfHeaderIsSet() throws Exception {
|
||||
this.request.setScheme("https");
|
||||
this.request.addHeader("X-Forwarded-Host", "somethingDifferent");
|
||||
adaptRequestFromForwardedHeaders();
|
||||
UriComponents uriComponents = fromController(PersonControllerImpl.class).build();
|
||||
@@ -150,6 +151,7 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void usesForwardedHostAndPortFromHeader() throws Exception {
|
||||
this.request.setScheme("https");
|
||||
request.addHeader("X-Forwarded-Host", "foobar:8088");
|
||||
adaptRequestFromForwardedHeaders();
|
||||
UriComponents uriComponents = fromController(PersonControllerImpl.class).build();
|
||||
@@ -159,6 +161,7 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void usesFirstHostOfXForwardedHost() throws Exception {
|
||||
this.request.setScheme("https");
|
||||
this.request.addHeader("X-Forwarded-Host", "barfoo:8888, localhost:8088");
|
||||
adaptRequestFromForwardedHeaders();
|
||||
UriComponents uriComponents = fromController(PersonControllerImpl.class).build();
|
||||
@@ -420,6 +423,7 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
initWebApplicationContext(PathPrefixWebConfig.class);
|
||||
|
||||
this.request.setScheme("https");
|
||||
this.request.setServerName("example.org");
|
||||
this.request.setServerPort(9999);
|
||||
this.request.setContextPath("/base");
|
||||
@@ -433,6 +437,7 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
initWebApplicationContext(PathPrefixWebConfig.class);
|
||||
|
||||
this.request.setScheme("https");
|
||||
this.request.setServerName("example.org");
|
||||
this.request.setServerPort(9999);
|
||||
this.request.setContextPath("/base");
|
||||
|
||||
@@ -111,7 +111,7 @@ public class AppCacheManifestTransformerTests {
|
||||
containsString("/static/js/bar-bd508c62235b832d960298ca6c0b7645.js"));
|
||||
|
||||
assertThat("should not rewrite external resources", content, containsString("//example.org/style.css"));
|
||||
assertThat("should not rewrite external resources", content, containsString("https://example.org/image.png"));
|
||||
assertThat("should not rewrite external resources", content, containsString("http://example.org/image.png"));
|
||||
|
||||
assertThat("should generate fingerprint", content,
|
||||
containsString("# Hash: 4bf0338bcbeb0a5b3a4ec9ed8864107d"));
|
||||
|
||||
Reference in New Issue
Block a user