(p []byte)
| 187 | } |
| 188 | |
| 189 | func (w *errorResponseWriter) Write(p []byte) (n int, err error) { |
| 190 | if w.status >= http.StatusBadRequest { |
| 191 | p, _ = json.Marshal( |
| 192 | &ServerComMessage{ |
| 193 | Ctrl: &MsgServerCtrl{ |
| 194 | Timestamp: time.Now().UTC().Round(time.Millisecond), |
| 195 | Code: w.status, |
| 196 | Text: http.StatusText(w.status), |
| 197 | }, |
| 198 | }) |
| 199 | } |
| 200 | return w.ResponseWriter.Write(p) |
| 201 | } |
| 202 | |
| 203 | // httpErrorHandler to respond with JSON_formatted error message for static content. |
| 204 | func httpErrorHandler(h http.Handler) http.Handler { |
no outgoing calls