Hi there, Why Ktor can not read response twice? A...
# ktor
r
Hi there, Why Ktor can not read response twice? Anyone find a workaround for this issue by any chance? It's getting super frustrating to handle this logic in an interceptor for a kmm project. https://youtrack.jetbrains.com/issue/KTOR-5223/Ktor-Cannot-read-response-multiple-times
r
r
Can this one be used in kmm clients?
r
That's a server plugin, so I guess no.
For the client I think you would just save the response locally and do what you want with it.
a
@Randy Tang do you try to receive a response body from a response validator?
r
@Aleksei Tirman [JB] no, I'm intercepting certain api responses with status code 200. Those api had access token error encapsulated in 200 and I want those errors to trigger refresh logic. However for a
correct
response, after the unwrapped the response body, it becomes empty for the upper layer
a
Can you share some of your interception code?
r
Deleted code
a
Ktor HTTP client can read a response twice, but it has the problem of reading it in an HTTP response validator.