DATAREST-1184 - Adapt to CORS changes in Spring Framework 5.0.3.
This commit is contained in:
committed by
Oliver Gierke
parent
08ede7ade7
commit
84cf20e1dd
@@ -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> {}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user