mirror of
https://git.ptzo.gdn/feditools/relay.git
synced 2024-09-21 09:27:12 +00:00
fix error reponses (#187)
Reviewed-on: https://git.ptzo.gdn/feditools/relay/pulls/187 Co-authored-by: Tyr Mactire <tyr@pettingzoo.co> Co-committed-by: Tyr Mactire <tyr@pettingzoo.co>
This commit is contained in:
parent
83b3d41008
commit
508a0351af
@ -74,6 +74,8 @@ func (s *Server) methodNotAllowedHandler() http.Handler {
|
||||
// wrap in middleware since middlware isn't run on error pages
|
||||
return s.WrapInMiddlewares(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", libhttp.MimeTextPlain.String())
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
|
||||
w.Write([]byte(fmt.Sprintf("%d %s", http.StatusMethodNotAllowed, http.StatusText(http.StatusMethodNotAllowed))))
|
||||
}))
|
||||
}
|
||||
@ -82,6 +84,8 @@ func (s *Server) notFoundHandler() http.Handler {
|
||||
// wrap in middleware since middlware isn't run on error pages
|
||||
return s.WrapInMiddlewares(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", libhttp.MimeTextPlain.String())
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
|
||||
w.Write([]byte(fmt.Sprintf("%d %s", http.StatusNotFound, http.StatusText(http.StatusNotFound))))
|
||||
}))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user