Skip to content

Configurable 404 and 405

Choose a tag to compare

@fulldump fulldump released this 03 Mar 00:51
· 10 commits to master since this release

Make configurable HandleResourceNotFound and HandleMethodNotAllowed.

Examples:

b := NewBox()
b.HandleResourceNotFound = func(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotFound)
	w.Write([]byte("HEY! Not Found"))
}
b.HandleMethodNotAllowed = func(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusMethodNotAllowed)
	w.Write([]byte("HEY! Method Not Allowed"))
}