zio-http icon indicating copy to clipboard operation
zio-http copied to clipboard

Decide using Endpoint codec in client based on status code

Open 987Nabil opened this issue 1 year ago • 0 comments

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.

987Nabil avatar Mar 13 '24 08:03 987Nabil