diff --git a/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/test/io/ktor/client/plugins/logging/NewFormatTest.kt b/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/test/io/ktor/client/plugins/logging/NewFormatTest.kt index 3a563f917e..2025017a16 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/test/io/ktor/client/plugins/logging/NewFormatTest.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/test/io/ktor/client/plugins/logging/NewFormatTest.kt @@ -477,6 +477,26 @@ class NewFormatTest { .assertNoMoreLogs() } + @Test + fun bodyResponseBodyBrEncoded() = testWithLevel(LogLevel.BODY, handle = { + respond(byteArrayOf(0xC3.toByte(), 0x28), headers = Headers.build { + append(HttpHeaders.ContentEncoding, "br") + append(HttpHeaders.ContentLength, "2") + }) + }) { client -> + client.get("/") + log.assertLogEqual("--> GET /") + .assertLogEqual("Accept-Charset: UTF-8") + .assertLogEqual("Accept: */*") + .assertLogEqual("--> END GET") + .assertLogMatch(Regex("""<-- 200 OK / \(\d+ms\)""")) + .assertLogEqual("Content-Encoding: br") + .assertLogEqual("Content-Length: 2") + .assertLogEqual("") + .assertLogMatch(Regex("""<-- END HTTP \(\d+ms, binary 2-byte body omitted\)""")) + .assertNoMoreLogs() + } + @Test fun bodyGzippedResponseBodyContentEncoding() = runTest { HttpClient(MockEngine) {