mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-01 11:48:04 +08:00
temporary/initial solution to seeing response message in swagger stats
This commit is contained in:
parent
3306b4f695
commit
c448769401
2 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue