Polish URL Cleanup

This commit is contained in:
Rob Winch
2019-03-21 23:47:38 -05:00
parent d99edd154f
commit 263868f018
39 changed files with 162 additions and 154 deletions

View File

@@ -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");

View File

@@ -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"));