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:
Oliver Gierke
2017-11-26 20:05:32 +01:00
parent 1642826a57
commit d3c5e339db
2 changed files with 1 additions and 2 deletions

View File

@@ -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"));
}

View File

@@ -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(),