NotFound is a catch-all handler for requests with no matching handler
(w http.ResponseWriter, r *http.Request)
| 37 | |
| 38 | // NotFound is a catch-all handler for requests with no matching handler |
| 39 | func (s *Static) NotFound(w http.ResponseWriter, r *http.Request) { |
| 40 | w.WriteHeader(http.StatusNotFound) |
| 41 | |
| 42 | accept := r.Header.Get("Accept") |
| 43 | |
| 44 | if strings.Contains(accept, "text/html") { |
| 45 | s.NotFoundView.Render(w, r, nil, http.StatusOK) |
| 46 | } else { |
| 47 | statusText := http.StatusText(http.StatusNotFound) |
| 48 | w.Write([]byte(statusText)) |
| 49 | } |
| 50 | } |
nothing calls this directly
no test coverage detected