mirror of
https://github.com/mpolden/echoip.git
synced 2025-03-15 08:40:08 +01:00
Respond with 204 on HEAD / requests
This commit is contained in:
parent
d84665c26c
commit
b405df2601
@ -269,6 +269,12 @@ func (s *Server) HealthHandler(w http.ResponseWriter, r *http.Request) *appError
|
||||
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 {
|
||||
response, err := s.newPortResponse(r)
|
||||
if err != nil {
|
||||
@ -426,6 +432,9 @@ func (s *Server) Handler() http.Handler {
|
||||
// Health
|
||||
r.Route("GET", "/health", s.HealthHandler)
|
||||
|
||||
// Health
|
||||
r.Route("HEAD", "/", s.HeadHandler)
|
||||
|
||||
// JSON
|
||||
r.Route("GET", "/", s.JSONHandler).Header("Accept", jsonMediaType)
|
||||
r.Route("GET", "/json", s.JSONHandler)
|
||||
|
Loading…
x
Reference in New Issue
Block a user