Skip to content

Commit

Permalink
Specify that log file endpoint's response is UTF-8 encoded
Browse files Browse the repository at this point in the history
Closes gh-16189
  • Loading branch information
wilkinsona committed Apr 2, 2019
1 parent 22c9364 commit 02b24b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public LogFileWebEndpoint(Environment environment) {
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void getRequestProducesResponseWithLogFile() {
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--");
}

Expand All @@ -77,7 +78,9 @@ public void getRequestThatAcceptsTextPlainProducesResponseWithLogFile() {
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
Expand Down

0 comments on commit 02b24b6

Please sign in to comment.