Custom 404 response.
(wrt http.ResponseWriter, req *http.Request)
| 210 | |
| 211 | // Custom 404 response. |
| 212 | func serve404(wrt http.ResponseWriter, req *http.Request) { |
| 213 | wrt.Header().Set("Content-Type", "application/json; charset=utf-8") |
| 214 | wrt.WriteHeader(http.StatusNotFound) |
| 215 | json.NewEncoder(wrt).Encode( |
| 216 | &ServerComMessage{ |
| 217 | Ctrl: &MsgServerCtrl{ |
| 218 | Timestamp: time.Now().UTC().Round(time.Millisecond), |
| 219 | Code: http.StatusNotFound, |
| 220 | Text: "not found", |
| 221 | }, |
| 222 | }) |
| 223 | } |
| 224 | |
| 225 | // Redirect HTTP requests to HTTPS |
| 226 | func tlsRedirect(toPort string) http.HandlerFunc { |
nothing calls this directly
no test coverage detected
searching dependent graphs…