Skip to content

Commit 7b13a8c

Browse files
committed
fix: invalid statusCode
1 parent 6729a9b commit 7b13a8c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function proxy (req, res, head, {
173173
return promise
174174
}
175175

176-
function onFinish (err, statusCode) {
176+
function onFinish (err, statusCode = 500) {
177177
const res = this[kRes]
178178

179179
assert(res)
@@ -206,6 +206,8 @@ function onFinish (err, statusCode) {
206206
} else if (/HPE_INVALID/.test(err.code)) {
207207
err.statusCode = 502
208208
}
209+
210+
statusCode = err.statusCode
209211
}
210212

211213
if (res.headersSent !== false) {

0 commit comments

Comments
 (0)