-
Notifications
You must be signed in to change notification settings - Fork 450
Description
I'd like to access raw response body when my client call fails, so e.g. I can log it.
Right now if I have an endpoint: Endpoint[Unit,Unit,Nothing,Unit,Any]
and do SttpClientInterpreter(SttpClientOptions.default).toRequest(endpoint, uri)(wsToPipe)(params).send(backend)
I receive Response[DecodeResult[Either[E, O]]]
. If this is unmapped error like 500, then we get Error(,java.lang.IllegalArgumentException: Cannot decode from: , request: GET http://localhost)
which doesn't bring much value.
Usually I'd like to have the raw body in hand in such cases and log it.
I can see that in sttp
there was similar issue softwaremill/sttp#190 which was implemented with asBoth
, however in tapir we don't have control over it (at least I can't see such option).
At the same time I wouldn't like to change my original endpoint to have raw String
in response.