DATAREST-1351 - URL Cleanup.

This commit is contained in:
Mark Paluch
2019-06-05 11:30:39 +02:00
parent db0b3e7860
commit 8acd867ba0
24 changed files with 69 additions and 69 deletions

View File

@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.CrossOrigin;
* @author Oliver Gierke
* @author Mark Paluch
*/
@CrossOrigin(origins = "http://not.so.far.away", //
@CrossOrigin(origins = "http://not.so.far.example", //
allowCredentials = "true", //
methods = { GET, PATCH, POST }, //
maxAge = 1234)

View File

@@ -53,7 +53,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
config.getCorsRegistry().addMapping("/books/**") //
.allowedMethods("GET", "PUT", "POST") //
.allowedOrigins("http://far.far.away");
.allowedOrigins("http://far.far.example");
});
}
}
@@ -64,7 +64,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
Link findItems = client.discoverUnique("items");
// Preflight request
mvc.perform(options(findItems.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.away")
mvc.perform(options(findItems.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.example")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) //
.andExpect(status().isOk()) //
.andExpect(
@@ -77,16 +77,16 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
Link findBooks = client.discoverUnique("books");
// Preflight request
mvc.perform(options(findBooks.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.away")
mvc.perform(options(findBooks.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.example")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) //
.andExpect(status().isOk()) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.away")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.example")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PUT,POST"));
// CORS request
mvc.perform(get(findBooks.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.away")) //
mvc.perform(get(findBooks.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.example")) //
.andExpect(status().isOk()) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.away"));
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.example"));
}
/**
@@ -97,20 +97,20 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
// Preflight request
mvc.perform(options("/books/xml/1234") //
.header(HttpHeaders.ORIGIN, "http://far.far.away") //
.header(HttpHeaders.ORIGIN, "http://far.far.example") //
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) //
.andExpect(status().isOk()) //
.andExpect(header().longValue(HttpHeaders.ACCESS_CONTROL_MAX_AGE, 77123)) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.away")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.example")) //
// See https://jira.spring.io/browse/SPR-14792
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, containsString("GET,PUT,POST")));
// CORS request
mvc.perform(get("/books/xml/1234") //
.header(HttpHeaders.ORIGIN, "http://far.far.away") //
.header(HttpHeaders.ORIGIN, "http://far.far.example") //
.accept(MediaType.APPLICATION_XML)) //
.andExpect(status().isOk()) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.away"));
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.example"));
}
/**
@@ -120,11 +120,11 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
public void appliesCorsConfigurationOnCustomControllerMethod() throws Exception {
// Preflight request
mvc.perform(options("/books/pdf/1234").header(HttpHeaders.ORIGIN, "http://far.far.away")
mvc.perform(options("/books/pdf/1234").header(HttpHeaders.ORIGIN, "http://far.far.example")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) //
.andExpect(status().isOk()) //
.andExpect(header().longValue(HttpHeaders.ACCESS_CONTROL_MAX_AGE, 4711)) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.away")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://far.far.example")) //
// See https://jira.spring.io/browse/SPR-14792
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, containsString("GET,PUT,POST")));
}
@@ -135,11 +135,11 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
Link authorsLink = client.discoverUnique("authors");
// Preflight request
mvc.perform(options(authorsLink.expand().getHref()).header(HttpHeaders.ORIGIN, "http://not.so.far.away")
mvc.perform(options(authorsLink.expand().getHref()).header(HttpHeaders.ORIGIN, "http://not.so.far.example")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) //
.andExpect(status().isOk()) //
.andExpect(header().longValue(HttpHeaders.ACCESS_CONTROL_MAX_AGE, 1234)) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://not.so.far.away")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://not.so.far.example")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH,POST"));
}
@@ -148,11 +148,11 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
public void appliesCorsConfigurationOnRepositoryToCustomControllers() throws Exception {
// Preflight request
mvc.perform(options("/authors/pdf/1234").header(HttpHeaders.ORIGIN, "http://not.so.far.away")
mvc.perform(options("/authors/pdf/1234").header(HttpHeaders.ORIGIN, "http://not.so.far.example")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) //
.andExpect(status().isOk()) //
.andExpect(header().longValue(HttpHeaders.ACCESS_CONTROL_MAX_AGE, 1234)) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://not.so.far.away")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://not.so.far.example")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH,POST"));
}