mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
fix(node/http): Request.setTimeout(0) should clear (#18949)
Fixes: #18932
This commit is contained in:
parent
2ee55145c0
commit
000315e75a
1 changed files with 12 additions and 0 deletions
|
@ -351,6 +351,18 @@ class ClientRequest extends NodeWritable {
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(timeout: number, callback?: () => void) {
|
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();
|
const controller = new AbortController();
|
||||||
this.opts.signal = controller.signal;
|
this.opts.signal = controller.signal;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue