wrapKaliumResponse

internal inline suspend fun <BodyType : Any> wrapKaliumResponse(unsuccessfulResponseOverride: (<Error class: unknown class>) -> NetworkResponse<BodyType>? = { null }, performRequest: () -> <Error class: unknown class>): NetworkResponse<BodyType>

Wraps a producer of HttpResponse and attempts to parse the server response based on the BodyType.

Return

Parameters

unsuccessfulResponseOverride

Allows to intercept any unsuccessful response and map it to a NetworkResponse as needed. This block can return null in order don't override. Useful when handling custom ErrorBody, for example.

performRequest

the block that will result into the HttpResponse

See also