logysia
logysia copied to clipboard
Custom non-200 statuses
I have an app that looks like this:
.get("/*", ({ params, set }) => {
if (Math.random() > 0.9) {
set.status = 403;
return "You have exceeded a secondary rate limit";
}
return { items: [] };
})
And when you hit it repeatedly, all the logging says is
...
GET /any/thing | 22µs
GET /any/thing | 21µs
GET /any/thing | 21µs
GET /any/thing | 22µs
GET /any/thing | 21µs
GET /any/thing | 21µs
GET /any/thing | 22µs
GET /any/thing | 22µs
GET /any/thing | 25µs
...
I guess, by default the logging string is about the request | about the response
and in the about the response
, the only thing is displays is the time it took (e.g. 21µs
).
Could the default mention non-200 exit codes too?