Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set a custom not-found handler. #10

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

umputun
Copy link
Member

@umputun umputun commented Oct 11, 2024

The handler allows setting a custom response body for unregistered (not found) resources and also allows setting a custom status code.

see #9

The handler allows setting a custom response body for unregistered (not found) resources and also allows setting a custom status code.
@umputun umputun mentioned this pull request Oct 11, 2024
@umputun umputun requested a review from paskal October 11, 2024 07:59
@umputun
Copy link
Member Author

umputun commented Oct 13, 2024

Note: As discussed in #9, the catch-all handler used in this PR to provide the hook for custom 404 doesn't play well with 405 (for modern mux only). The issue has been discussed several times in the Go repository, but there is no final conclusion yet on whether it is worth fixing.

The introduction of the new NotFoundHandler doesn't make the 405 situation any worse, as the current default already sets the catch-all handler.

@umputun umputun merged commit 10beae3 into master Oct 13, 2024
6 checks passed
@umputun umputun deleted the custom-not-found branch October 13, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants