mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(node/http): Request.setTimeout(0) should clear (#18949)
Fixes: #18932
This commit is contained in:
parent
fae7643648
commit
348946aa5e
1 changed files with 12 additions and 0 deletions
|
@ -351,6 +351,18 @@ class ClientRequest extends NodeWritable {
|
|||
}
|
||||
|
||||
setTimeout(timeout: number, callback?: () => void) {
|
||||
if (timeout == 0) {
|
||||
// Node's underlying Socket implementation expects a 0 value to disable the
|
||||
// existing timeout.
|
||||
if (this.opts.timeout) {
|
||||
clearTimeout(this.opts.timeout);
|
||||
this.opts.timeout = undefined;
|
||||
this.opts.signal = undefined;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
this.opts.signal = controller.signal;
|
||||
|
||||
|
|
Loading…
Reference in a new issue