reitit 2025-02-08

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?

What happens if you return nil?

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

👍 1

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

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