Bug Description
Socks5ProxyAgent.dispatch() returns a Promise instead of boolean
Socks5ProxyAgent[kDispatch] is declared async, so the public Socks5ProxyAgent.dispatch() method returns a Promise instead of the documented boolean backpressure signal.
Dispatcher.dispatch() is documented to return Boolean, where false means the dispatcher is busy until a 'drain' event is emitted. Socks5ProxyAgent.dispatch() currently cannot provide that synchronous signal because async [kDispatch] wraps the underlying pool[kDispatch](opts, handler) return value in a Promise.
Reproducible By
import { Socks5ProxyAgent } from 'undici'
const agent = new Socks5ProxyAgent('socks5://127.0.0.1:1080')
const ret = agent.dispatch({
origin: 'http://example.com',
path: '/',
method: 'GET'
}, {
onConnect () {},
onHeaders () {},
onData () {},
onComplete () {},
onError () {}
})
console.log(ret)
console.log(typeof ret.then)
Expected Behavior
Socks5ProxyAgent.dispatch() should return the synchronous boolean returned by the underlying dispatcher
Logs & Screenshots
Promise { <pending> }
function
Environment
macOS 26.4.1
Node v24.15.0
undici v8.2.0
Bug Description
Socks5ProxyAgent.dispatch() returns a Promise instead of boolean
Socks5ProxyAgent[kDispatch]is declaredasync, so the publicSocks5ProxyAgent.dispatch()method returns aPromiseinstead of the documented boolean backpressure signal.Dispatcher.dispatch()is documented to returnBoolean, wherefalsemeans the dispatcher is busy until a'drain'event is emitted.Socks5ProxyAgent.dispatch()currently cannot provide that synchronous signal becauseasync [kDispatch]wraps the underlyingpool[kDispatch](opts, handler)return value in a Promise.Reproducible By
Expected Behavior
Socks5ProxyAgent.dispatch() should return the synchronous boolean returned by the underlying dispatcher
Logs & Screenshots
Environment
macOS 26.4.1
Node v24.15.0
undici v8.2.0