Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript
https://effect.website
MIT License
7.6k stars 242 forks source link

HttpApi: `transformClient` does not support composition with e.g. `HttpClient.retry` #3715

Open fubhy opened 1 month ago

fubhy commented 1 month ago

What version of Effect is running?

No response

What steps can reproduce the bug?

It'd appear that adding a generic retry handler in the transformClient phase is not supported because the response handling of HttpApi is added later.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

fubhy commented 1 month ago

In general I'd argue that the HttpApi and the HttpClient api are clashing a little bit in the transformClient code path. The interplay of HttpClient.retry, HttpClient.filter*, etc. with the underlying HttpApi declaration only becomes clear when following the implementation of HttpApiClient.make all the way.

I don't have any better suggestions so far but somehow this doesn't feel perfect yet :-)