Use HTTPS for external links wherever possible
See gh-16319
This commit is contained in:
committed by
Andy Wilkinson
parent
e2de2c8238
commit
1a4c6f2dac
@@ -41,21 +41,21 @@ public class LinkTests {
|
||||
|
||||
@Test
|
||||
public void getHrefShouldReturnHref() {
|
||||
String href = "http://example.com";
|
||||
String href = "https://example.com";
|
||||
Link link = new Link(href);
|
||||
assertThat(link.getHref()).isEqualTo(href);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTemplatedWhenContainsPlaceholderShouldReturnTrue() {
|
||||
String href = "http://example.com/{path}";
|
||||
String href = "https://example.com/{path}";
|
||||
Link link = new Link(href);
|
||||
assertThat(link.isTemplated()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTemplatedWhenContainsNoPlaceholderShouldReturnFalse() {
|
||||
String href = "http://example.com/path";
|
||||
String href = "https://example.com/path";
|
||||
Link link = new Link(href);
|
||||
assertThat(link.isTemplated()).isFalse();
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ public class WebFluxEndpointIntegrationTests extends
|
||||
load(TestEndpointConfiguration.class, (client) -> client.options().uri("/test")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.header("Access-Control-Request-Method", "POST")
|
||||
.header("Origin", "http://example.com").exchange().expectStatus().isOk()
|
||||
.header("Origin", "https://example.com").exchange().expectStatus().isOk()
|
||||
.expectHeader()
|
||||
.valueEquals("Access-Control-Allow-Origin", "http://example.com")
|
||||
.valueEquals("Access-Control-Allow-Origin", "https://example.com")
|
||||
.expectHeader().valueEquals("Access-Control-Allow-Methods", "GET,POST"));
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class WebFluxEndpointIntegrationTests extends
|
||||
Environment environment, WebEndpointDiscoverer endpointDiscoverer,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com"));
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
|
||||
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST"));
|
||||
return new WebFluxEndpointHandlerMapping(
|
||||
new EndpointMapping(environment.getProperty("endpointPath")),
|
||||
|
||||
@@ -88,9 +88,9 @@ public class MvcWebEndpointIntegrationTests extends
|
||||
load(TestEndpointConfiguration.class, (client) -> client.options().uri("/test")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.header("Access-Control-Request-Method", "POST")
|
||||
.header("Origin", "http://example.com").exchange().expectStatus().isOk()
|
||||
.header("Origin", "https://example.com").exchange().expectStatus().isOk()
|
||||
.expectHeader()
|
||||
.valueEquals("Access-Control-Allow-Origin", "http://example.com")
|
||||
.valueEquals("Access-Control-Allow-Origin", "https://example.com")
|
||||
.expectHeader().valueEquals("Access-Control-Allow-Methods", "GET,POST"));
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class MvcWebEndpointIntegrationTests extends
|
||||
Environment environment, WebEndpointDiscoverer endpointDiscoverer,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com"));
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
|
||||
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST"));
|
||||
return new WebMvcEndpointHandlerMapping(
|
||||
new EndpointMapping(environment.getProperty("endpointPath")),
|
||||
|
||||
Reference in New Issue
Block a user