logysia icon indicating copy to clipboard operation
logysia copied to clipboard

Custom non-200 statuses

Open peterbe opened this issue 3 months ago • 0 comments

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?

peterbe avatar Mar 13 '24 16:03 peterbe