effect icon indicating copy to clipboard operation
effect copied to clipboard

HttpApi: Error response with string body causes decode error

Open fubhy opened this issue 1 year ago • 0 comments

What version of Effect is running?

No response

What steps can reproduce the bug?

Error handling currently assumes that the response is JSON parsable. That's not always the case e.g. if the response body is just a pure string like "Rate limit exceeded".

https://github.com/Effect-TS/effect/blob/main/packages/platform/src/HttpApiClient.ts#L126

The recovery path here is fairly reasonable at first glance but I should be able to properly decode plain values here too instead of just JSON.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

fubhy avatar Oct 01 '24 10:10 fubhy