async function test() {
const undici = require('undici');
class CustomAgent extends undici.Agent {
constructor() {
super({
keepAliveTimeout: 10,
keepAliveMaxTimeout: 10
});
}
dispatch(options, handler) {
console.log("DISPATCH");
return super.dispatch(options, handler);
}
}
const request = new undici.Request("https://example.org", {
dispatcher: new CustomAgent()
});
// will make an HTTP call and print "DISPATCH"
await undici.fetch(request);
// will make an HTTP call, but not print "DISPATCH"
await undici.fetch(request.clone());
}
test();
none.
Bug Description
Reproducible By
Consider this code:
Expected Behavior
In the code above, I would expect both
fetchcalls to use the dispatcher.Logs & Screenshots
none.
Environment
NodeJS, Version v22.9.0
Additional context