wrapKaliumResponse
Wraps a producer of HttpResponse and attempts to parse the server response based on the BodyType.
Return
Successful response (HTTP Status Codes from 200 to 299): a NetworkResponse.Success with the expected BodyType will be returned.
Unsuccessful response (any other HTTP Status Code): a NetworkResponse.Error with a KaliumException. Will try to read it the body as an ErrorResponse. It's possible to intercept this and do the mapping to a NetworkResponse through unsuccessfulResponseOverride.
Exceptions failure to reach server or parse response: a NetworkResponse.Error containing a KaliumException.GenericError
Parameters
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.
the block that will result into the HttpResponse