Based on my experience working with undici through nxt-undici and building a more advanced client on top undici I have come to a few realizations that have semver major implications:
onBodySent and onRequestSent are huge footguns. Remove it. (just wrap the body)
interceptors are weird and overengineered. Remove it. (just wrap dispatchers)
onConnect is confusing and should be renamed or something to make it more intuitive. Possibly entirely removed.
body should support a factory method (important for retries and redirects).
onResponseStarted. Why is onHeaders insufficient?
maxRedirections and RedirectHandler should not be part of core/dispatcher APi. Move to the api methods.
- Change hooks signature to accept objects instead of params.
- Rename disatpcher param to dispatch which is just a function (opts, handler) => {}
Based on my experience working with undici through nxt-undici and building a more advanced client on top undici I have come to a few realizations that have semver major implications:
onBodySentandonRequestSentare huge footguns. Remove it. (just wrap the body)interceptorsare weird and overengineered. Remove it. (just wrap dispatchers)onConnectis confusing and should be renamed or something to make it more intuitive. Possibly entirely removed.bodyshould support a factory method (important for retries and redirects).onResponseStarted. Why is onHeaders insufficient?maxRedirectionsandRedirectHandlershould not be part of core/dispatcher APi. Move to the api methods.