Skip to content

Commit 2697bf2

Browse files
committed
Add Content-Type to allowed headers for CloudFoundry actuators
See gh-7108
1 parent 2930bd4 commit 2697bf2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ private CorsConfiguration getCorsConfiguration() {
9090
corsConfiguration.addAllowedOrigin(CorsConfiguration.ALL);
9191
corsConfiguration.setAllowedMethods(
9292
Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name()));
93-
corsConfiguration
94-
.setAllowedHeaders(Arrays.asList("Authorization", "X-Cf-App-Instance"));
93+
corsConfiguration.setAllowedHeaders(
94+
Arrays.asList("Authorization", "X-Cf-App-Instance", "Content-Type"));
9595
return corsConfiguration;
9696
}
9797

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfigurationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public void cloudFoundryPlatformActive() throws Exception {
8282
CorsConfiguration corsConfiguration = (CorsConfiguration) ReflectionTestUtils
8383
.getField(handlerMapping, "corsConfiguration");
8484
assertThat(corsConfiguration.getAllowedOrigins()).contains("*");
85-
assertThat(corsConfiguration.getAllowedMethods()).contains(HttpMethod.GET.name(),
86-
HttpMethod.POST.name());
87-
assertThat(corsConfiguration.getAllowedHeaders()
88-
.containsAll(Arrays.asList("Authorization", "X-Cf-App-Instance")));
85+
assertThat(corsConfiguration.getAllowedMethods()).containsAll(
86+
Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name()));
87+
assertThat(corsConfiguration.getAllowedHeaders()).containsAll(
88+
Arrays.asList("Authorization", "X-Cf-App-Instance", "Content-Type"));
8989
}
9090

9191
@Test

0 commit comments

Comments
 (0)