zio-http
zio-http copied to clipboard
Decide using Endpoint codec in client based on status code
Currently this code in EndpointClient
if (response.status.isSuccess) {
endpoint.output.decodeResponse(response).orDie
} else {
//use error codec
}
forces the error codec to be used for all status codes that are not 2xx/3xx.
This is an issue, since I as a user cannot decide that for example a 2xx is an error or a 4xx is not (means goes to E or A of the resulting ZIO).
We should choose the codec purely based on the mapping from returned status code to the codec with that status code.