You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a library that proxies undici in an unintended way, changing the type of opts.body to AsyncGenerator. I would like to read the generator and reply with the result, but it's not possible because reply callback isn't awaited. This was discussed more in-depth here #1756.
This capability would also allow awaiting other async functions in the callback
The implementation should look like...
In my specific use-case, I'd be able to read AsyncGenerator and return the body string:
.reply(200, async (opts) => {
const buffers = [];
for await (const data of opts.body) {
buffers.push(data);
}
const body = Buffer.concat(buffers).toString('utf8');
return body;
});
The text was updated successfully, but these errors were encountered:
This would solve...
I am using a library that proxies
undici
in an unintended way, changing the type ofopts.body
toAsyncGenerator
. I would like to read the generator and reply with the result, but it's not possible because reply callback isn't awaited. This was discussed more in-depth here #1756.This capability would also allow awaiting other async functions in the callback
The implementation should look like...
In my specific use-case, I'd be able to read
AsyncGenerator
and return the body string:The text was updated successfully, but these errors were encountered: