reitit

weavejester 2025-02-08T23:59:54.884199Z

The default handler can return a 404 response if no route matches. I can also return a 404 from a matched route to indicate the resource doesn't exist. However, these two 404 responses are designated separately. Is there something I can return from the route to indicate to the default handler that the default 404 response should be returned?

DrLjótsson 2025-02-09T08:27:54.423199Z

What happens if you return nil?

weavejester 2025-02-09T13:40:44.522929Z

It returns a 406 response as defined by the :not-acceptable key on the default handler.

👍 1
opqdonut 2025-02-10T06:20:27.176839Z

I guess you could throw a 404 exception and have a middleware in the right spot turn that to nil...

valerauko 2025-02-10T08:26:32.354719Z

You could have a handler for 404 errors and call that handler function from your route handler if the resource is missing