Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Oct 26, 2020
1 parent dbcb126 commit 6b63388
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/core/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,17 @@ class Request {
onHeaders (statusCode, headers, resume) {
assert(!this.aborted)

clearTimeout(this[kTimeout])
this[kTimeout] = null
if (statusCode >= 200 && this[kBodyTimeout]) {
clearTimeout(this[kTimeout])
this[kTimeout] = null

if (this[kBodyTimeout]) {
this[kTimeout] = setTimeout((self) => {
if (!self[kPaused]) {
self[kAbort](new BodyTimeoutError())
}
}, this[kBodyTimeout], this)
} else if (this[kTimeout]) {
this[kTimeout].refresh()
}

const ret = this[kHandler].onHeaders(statusCode, headers, () => {
Expand Down

0 comments on commit 6b63388

Please sign in to comment.