https://kotlinlang.org logo
Title
r

ribesg

03/18/2020, 9:25 AM
The
ByteReadChannel
passed as
response.content
inside a
ResponseObserver
is now cancelled after updating from Ktor Client 1.3.0 to 1.3.2, what are we supposed to do with that?
👀 1
I’m trying to reimplement an interceptor close to ResponseObserver in my logging feature but half the things it uses are internal 😞
Ok so it looks like it only happens on one of the endpoints I use, this endpoint’s response body is just
OK
. Maybe there’s a race condition that usually allows to log the body before the request’s scope/context disappears because it already takes time to read/deserialize it? And in this case as it’s just
OK
and I ignore the response (I’m doing a
get<Unit>
) the request is ended before the logging ends? I just don’t really know how all of this works, but would that make sense @e5l?
e

e5l

03/18/2020, 10:49 AM
It looks like problem: could you confirm that if you’re using
get<String>
log contains response body?
r

ribesg

03/18/2020, 10:50 AM
I’ll test that and get back to you it should take me half an hour (yay native compile times 😶)
e

e5l

03/18/2020, 10:50 AM
It looks like
get<Unit>
cancell the response body and logging also cancels(and it looks like the expected behaviour)
r

ribesg

03/18/2020, 10:51 AM
Ok, I would just expect anything present to be logged, even if not read/used by the user
e

e5l

03/18/2020, 10:52 AM
Maybe we can add
response was cancelled by user
message, could you file an issue?
r

ribesg

03/18/2020, 10:52 AM
But you’re right, if I know the endpoint returns a String, I should get a String. It’s my service that should return Unit, not the actual request
Well yeah just a more clear message would help, I’ll open an issue
e

e5l

03/18/2020, 10:53 AM
Awesome, thanks
I changed
get<Unit>
to
get<String>
and there are no more errors 👍