DATAREST-1160 - Adapt tests to new CORS defaults in Spring Framework.
Spring Framework 5.0.2 changes the default for the Allow-Credentials header to false. We now adapted our test case to that and also drop the expectation to see the request URL in the Allow-Origin header as that is only returned if Allow-Credentials is true, which it now isn't by default.
This commit is contained in:
@@ -73,7 +73,6 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
mvc.perform(options(findItems.expand().getHref()).header(HttpHeaders.ORIGIN, "http://far.far.away")
|
||||
.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,HEAD,POST,PUT,PATCH,DELETE,OPTIONS,TRACE"));
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class RepositoryCorsConfigurationAccessorUnitTests {
|
||||
CorsConfiguration configuration = accessor.createConfiguration(AnnotatedRepository.class);
|
||||
|
||||
assertThat(configuration).isNotNull();
|
||||
assertThat(configuration.getAllowCredentials()).isTrue();
|
||||
assertThat(configuration.getAllowCredentials()).isFalse();
|
||||
assertThat(configuration.getAllowedHeaders()).contains("*");
|
||||
assertThat(configuration.getAllowedOrigins()).contains("*");
|
||||
assertThat(configuration.getAllowedMethods(),
|
||||
|
||||
Reference in New Issue
Block a user