mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-05-03 03:43:54 +01:00
Specify that log file endpoint's response is UTF-8 encoded
Closes gh-16189
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ public class LogFileWebEndpoint {
|
||||
this(environment, null);
|
||||
}
|
||||
|
||||
@ReadOperation(produces = "text/plain")
|
||||
@ReadOperation(produces = "text/plain; charset=UTF-8")
|
||||
public Resource logFile() {
|
||||
Resource logFileResource = getLogFileResource();
|
||||
if (logFileResource == null || !logFileResource.isReadable()) {
|
||||
|
||||
+4
-1
@@ -69,6 +69,7 @@ public class LogFileWebEndpointWebIntegrationTests {
|
||||
TestPropertyValues.of("logging.file:" + this.logFile.getAbsolutePath())
|
||||
.applyTo(context);
|
||||
client.get().uri("/actuator/logfile").exchange().expectStatus().isOk()
|
||||
.expectHeader().contentType("text/plain; charset=UTF-8")
|
||||
.expectBody(String.class).isEqualTo("--TEST--");
|
||||
}
|
||||
|
||||
@@ -77,7 +78,9 @@ public class LogFileWebEndpointWebIntegrationTests {
|
||||
TestPropertyValues.of("logging.file:" + this.logFile.getAbsolutePath())
|
||||
.applyTo(context);
|
||||
client.get().uri("/actuator/logfile").accept(MediaType.TEXT_PLAIN).exchange()
|
||||
.expectStatus().isOk().expectBody(String.class).isEqualTo("--TEST--");
|
||||
.expectStatus().isOk().expectHeader()
|
||||
.contentType("text/plain; charset=UTF-8").expectBody(String.class)
|
||||
.isEqualTo("--TEST--");
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
Reference in New Issue
Block a user