microsoft / typed-rest-client

Node Rest and Http Clients with typings for use with TypeScript
Other
675 stars 118 forks source link

Discussion: use Undici #379

Open sebastien-comeau opened 1 month ago

sebastien-comeau commented 1 month ago

Environment

Node version: v18 and newer typed-rest-client version: Latest

Issue Description

I'm eager to leverage typed-rest-client within my Remix application. However, I believe its current reliance on http and https limits its potential for certain advanced features.

Specifically, I'm interested in incorporating:

These features can be more effectively managed with undici.

I'm considering forking the repository to implement this transition. I'd appreciate your insights on the feasibility and potential implications of such a change.

sebastien-comeau commented 1 week ago

Anyone?

KonstantinTyukalov commented 4 days ago

Hi @sebastien-comeau, thanks for the reporting! We are working on higher priority issues now, but we'll get back to this one once we'll have capacity.

Note that this client is currently supporting node 16, so to add the undici features we'll need to drop the node 16 support.

Regarding retries, we currently have simple built-in retry logic: https://github.com/microsoft/typed-rest-client/blob/92f407b74bb80dba0de725628d65aa22d0dae57b/lib/Interfaces.ts#L57-L59

Also note that the main goal of the typed-rest-client package is to provide RESTful request-response wrappers, so it wasn't designed for 'fire-and-forget' (am I right that this is something undici's Dispatcher do?) use cases initially