mirror of
https://github.com/mpolden/echoip.git
synced 2025-07-13 20:45:25 +02:00
Respond with 204 on HEAD / requests
This commit is contained in:
@ -269,6 +269,12 @@ func (s *Server) HealthHandler(w http.ResponseWriter, r *http.Request) *appError
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) HeadHandler(w http.ResponseWriter, r *http.Request) *appError {
|
||||||
|
return &appError{
|
||||||
|
Code: http.StatusNoContent,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) PortHandler(w http.ResponseWriter, r *http.Request) *appError {
|
func (s *Server) PortHandler(w http.ResponseWriter, r *http.Request) *appError {
|
||||||
response, err := s.newPortResponse(r)
|
response, err := s.newPortResponse(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -426,6 +432,9 @@ func (s *Server) Handler() http.Handler {
|
|||||||
// Health
|
// Health
|
||||||
r.Route("GET", "/health", s.HealthHandler)
|
r.Route("GET", "/health", s.HealthHandler)
|
||||||
|
|
||||||
|
// Health
|
||||||
|
r.Route("HEAD", "/", s.HeadHandler)
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
r.Route("GET", "/", s.JSONHandler).Header("Accept", jsonMediaType)
|
r.Route("GET", "/", s.JSONHandler).Header("Accept", jsonMediaType)
|
||||||
r.Route("GET", "/json", s.JSONHandler)
|
r.Route("GET", "/json", s.JSONHandler)
|
||||||
|
Reference in New Issue
Block a user