temporary/initial solution to seeing response message in swagger stats

This commit is contained in:
Miodec 2022-02-28 22:58:28 +01:00
parent 3306b4f695
commit c448769401
2 changed files with 4 additions and 2 deletions

View file

@ -43,7 +43,9 @@ function addApiRoutes(app: Application): void {
password === process.env.STATS_PASSWORD
);
},
onResponseFinish: (_req, _res, rrr) => {
onResponseFinish: (_req, res, rrr) => {
//@ts-ignore ignored because monkeyMessage doesnt exist on the type
rrr.http.response.message = res.monkeyMessage;
if (process.env.MODE === "dev") {
return;
}

View file

@ -14,7 +14,7 @@ export function handleMonkeyResponse(handlerData, res) {
const { message, data, status } = monkeyResponse;
res.status(status);
res.monkeyMessage = message; // so that we can see message in swagger stats
if ([301, 302].includes(status)) {
return res.redirect(data);
}