Skip to content

Commit fab235f

Browse files
committed
fix: Only forward first error. Ignore multiple errors.
1 parent 212369e commit fab235f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ function impl (req, resOrSocket, headOrNil, {
4545
onReq,
4646
onRes
4747
}, onProxyError) {
48+
let hasError = false
49+
4850
function onError (err, statusCode = (err && err.statusCode) || 500) {
51+
if (hasError) {
52+
return
53+
}
54+
55+
hasError = true
56+
4957
if (resOrSocket.closed === true ||
5058
resOrSocket.headersSent !== false ||
5159
!resOrSocket.writeHead

0 commit comments

Comments
 (0)