Hello!
We use a generic service skeleton based on chi in our company. Sometimes we needn't handle http-request and our skeleton creates chi.Mux with no roures.
If someone try to ping our service, it fails with panic because of this if section.
I think Chi should return 404 error instead of panic.
Why don't you add a 404 handler in your skeleton app's code?
I'm not sure if this is the right call. The panic might be useful for some folks that forget to mount the handlers correctly.
Let's poll the community for their opinions:
馃憤 for HTTP 404; 馃憥 for keeping the panic as is; 馃帀 for panicking at the startup time
I understood your point, but in this case we create a service which can panic at the random moment when someone send any http request. And developer don't know about this behavior.
Maybe we should panic at service startup
@makhov that's a good point, thanks. Let me add it as a third option to the poll.
done in https://github.com/go-chi/chi/pull/378 -- in v4, we will return 404 for an empty mux
Most helpful comment
Why don't you add a 404 handler in your skeleton app's code?
I'm not sure if this is the right call. The panic might be useful for some folks that forget to mount the handlers correctly.
Let's poll the community for their opinions:
馃憤 for HTTP 404; 馃憥 for keeping the panic as is; 馃帀 for panicking at the startup time