Lubomir Pisk
01/23/2023, 9:44 PMAleksei Tirman [JB]
01/23/2023, 9:52 PMLubomir Pisk
01/24/2023, 10:40 AMAleksei Tirman [JB]
01/24/2023, 1:29 PMRefreshTokenInterceptor
?Lubomir Pisk
01/24/2023, 1:31 PMAleksei Tirman [JB]
01/25/2023, 7:43 AMByteReadChannel
so the other parts of your application could read the body once more.
val client = HttpClient(CIO)
client.plugin(HttpSend).intercept { request ->
val call = execute(request)
val body = call.response.content
val bytes = body.readRemaining().readBytes()
// Manipulate bytes here
HttpClientCall(
client,
request.build(),
HttpResponseData(
statusCode = call.response.status,
requestTime = call.response.requestTime,
headers = call.response.headers,
version = call.response.version,
body = ByteReadChannel(bytes),
callContext = call.response.coroutineContext
)
)
}
val r = client.get("<https://httpbin.org/get>")
println(r.bodyAsText())