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.addAllowedOrigin(CorsConfiguration.ALL);
corsConfiguration.setAllowedMethods( corsConfiguration.setAllowedMethods(
Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name())); Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name()));
corsConfiguration corsConfiguration.setAllowedHeaders(
.setAllowedHeaders(Arrays.asList("Authorization", "X-Cf-App-Instance")); Arrays.asList("Authorization", "X-Cf-App-Instance", "Content-Type"));
return corsConfiguration; return corsConfiguration;
} }

View File

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