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
Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided).
However, when using HTTP2 mode, the requests are terminated before the pending requests complete.
Reproducible By
import{Client}from'undici'consturl=newURL('https://identity.foundation/.well-known/did.json')constdispatcher=newClient(url.origin,{allowH2: true,// <=== "true" here causes an error. "false" doesn't})constres=awaitglobalThis.fetch(url,{ dispatcher })dispatcher.close().then(()=>{console.info('closed')},(err)=>{console.error('failed closing',err)},)awaitres.json()/** * TypeError: terminated * at Request.onError (node_modules/.pnpm/[email protected]/node_modules/undici/lib/core/request.js:299:27) * at Object.errorRequest (node_modules/.pnpm/[email protected]/node_modules/undici/lib/core/util.js:638:13) * at abort (node_modules/.pnpm/[email protected]/node_modules/undici/lib/dispatcher/client-h2.js:277:10) * at ClientHttp2Stream.<anonymous> (node_modules/.pnpm/[email protected]/node_modules/undici/lib/dispatcher/client-h2.js:452:5) */
Expected Behavior
Same behavior as when allowH2: false: no error & client can be closed before completing.
Logs & Screenshots
Environment
Node: v18.20.4
Undici: 6.19.8
The text was updated successfully, but these errors were encountered:
Bug Description
Dispatcher.close()
is documented as:However, when using HTTP2 mode, the requests are terminated before the pending requests complete.
Reproducible By
Expected Behavior
Same behavior as when
allowH2: false
: no error & client can be closed before completing.Logs & Screenshots
Environment
Node: v18.20.4
Undici: 6.19.8
The text was updated successfully, but these errors were encountered: