DATAREST-1184 - Adapt to CORS changes in Spring Framework 5.0.3.

This commit is contained in:
Mark Paluch
2018-01-24 10:23:27 +01:00
committed by Oliver Gierke
parent 08ede7ade7
commit 84cf20e1dd
2 changed files with 5 additions and 5 deletions

View File

@@ -26,6 +26,6 @@ import org.springframework.web.bind.annotation.CrossOrigin;
*/
@CrossOrigin(origins = "http://not.so.far.away", //
allowCredentials = "true", //
methods = { GET, PATCH }, //
methods = { GET, PATCH, POST }, //
maxAge = 1234)
public interface AuthorRepository extends CrudRepository<Author, Long> {}

View File

@@ -84,7 +84,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
// Preflight request
mvc.perform(options(findBooks.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.away")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) //
.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_METHODS, "GET,PUT,POST"));
@@ -142,12 +142,12 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
// Preflight request
mvc.perform(options(authorsLink.expand().getHref()).header(HttpHeaders.ORIGIN, "http://not.so.far.away")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) //
.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_CREDENTIALS, "true")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH"));
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH,POST"));
}
@Test // DATAREST-573
@@ -160,7 +160,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
.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_CREDENTIALS, "true")) //
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH"));
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH,POST"));
}
@RepositoryRestController