We use the onBodySent hook, we use it to "await" the request until the data was sent on the socket, then we just resolve the promise while handling the request in the background, with some fallback to queue in case request fails.
This is useful if u have to make sure data transfer completed, and u assume that in most of the cases it will be handled successfully(with some fallback if not), and we do not really care on awaiting data processing on the other side.
Looks like it is impossible to implement it now in V7.
Is it removed completely or there are plans to bing it back at some point?
There is some plans to add request hooks. But nothing I have time to look into atm. You can achieve the same behavior by wrapping the body in a stream and waiting for the 'end' event.
I see
onBodySent
hook was removed here https://github.com/nodejs/undici/pull/3878We use the
onBodySent
hook, we use it to "await" the request until the data was sent on the socket, then we just resolve the promise while handling the request in the background, with some fallback to queue in case request fails.This is useful if u have to make sure data transfer completed, and u assume that in most of the cases it will be handled successfully(with some fallback if not), and we do not really care on awaiting data processing on the other side. Looks like it is impossible to implement it now in V7.
Is it removed completely or there are plans to bing it back at some point?