Effect CommunityEC
Effect Community12mo ago
11 replies
thewilkybarkid

Exploring HttpClient to Fetch Implementation for Gradual Migration to Effect

I'm revisiting a thought I'd had previously about turning an HttpClient into a
fetch
implementation (platform), and was wondering if anyone else had experimented in this area since then? We're migrating a different Node project to Effect and quite a bit depends on the
fetch
interface. These modules will be changed to use Effect+HttpClient, but it's a gradual migration. We currently use make-fetch-happen as our
fetch
implementation, which handles HTTP caching. However, it causes us problems as it's only filesystem-based. We had been hoping Undici's recent cache feature would work (as it has different cache adapters), but we had no end of trouble trying to use it. Instead, we're now looking into a custom HTTP-ish cache for our app (easier to produce as it doesn't have to follow all the semantics of HTTP caching). I'd much rather do this in Effect, but this does mean having some way of making it compatible with the legacy code.
Was this page helpful?