Skip to content

Commit 363e6a6

Browse files
committed
fix(express-wrapper): dont override status code in req
In the event of an error in handleRequest, only set the status code on the request if it hasn't already been set. Overriding the status code in the event of an error results in incorrect reporting of the error status code using plugins such as prom-bundle to generate metrics.
1 parent b65132e commit 363e6a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/express-wrapper/src/request.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ export const handleRequest = (
131131
const response = await serviceFn(handlerParams);
132132
responseEncoder(httpRoute, response)(req, res, next);
133133
} catch (err) {
134-
res.status(500).end();
134+
if (!res.statusCode) {
135+
res.status(500);
136+
}
137+
res.end();
135138
next();
136139
return;
137140
}

0 commit comments

Comments
 (0)