Add Content-Type to allowed headers for CloudFoundry actuators

See gh-7108
This commit is contained in:
Madhura Bhave 2016-11-11 12:09:16 -08:00
parent 2930bd4145
commit 2697bf2ba1
2 changed files with 6 additions and 6 deletions

View File

@ -90,8 +90,8 @@ public class CloudFoundryActuatorAutoConfiguration {
corsConfiguration.addAllowedOrigin(CorsConfiguration.ALL);
corsConfiguration.setAllowedMethods(
Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name()));
corsConfiguration
.setAllowedHeaders(Arrays.asList("Authorization", "X-Cf-App-Instance"));
corsConfiguration.setAllowedHeaders(
Arrays.asList("Authorization", "X-Cf-App-Instance", "Content-Type"));
return corsConfiguration;
}

View File

@ -82,10 +82,10 @@ public class CloudFoundryActuatorAutoConfigurationTests {
CorsConfiguration corsConfiguration = (CorsConfiguration) ReflectionTestUtils
.getField(handlerMapping, "corsConfiguration");
assertThat(corsConfiguration.getAllowedOrigins()).contains("*");
assertThat(corsConfiguration.getAllowedMethods()).contains(HttpMethod.GET.name(),
HttpMethod.POST.name());
assertThat(corsConfiguration.getAllowedHeaders()
.containsAll(Arrays.asList("Authorization", "X-Cf-App-Instance")));
assertThat(corsConfiguration.getAllowedMethods()).containsAll(
Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name()));
assertThat(corsConfiguration.getAllowedHeaders()).containsAll(
Arrays.asList("Authorization", "X-Cf-App-Instance", "Content-Type"));
}
@Test