echo
echo copied to clipboard
fix panic when both handler and middlewares are nil
could you explain why this case should act as no-op instead of panic? most of the cases I think providing nil for these value should be considered as something going very wrong.
Showing a 404 error is better than showing a panic error. I don't think it's possible for someone to intentionally not send the handler and only set the route. An empty handler is like the absence of that page. So 404 is more suitable.
Hi @aldas, could you please check this PR?
I really do not want to accept this behavior.
Probably just doing this is better
if handler == nil {
panic("can not add route with nil handler")
}
to fail fast and before even the server is started. Adding route without handler is something deeply wrong in developers code.