(status int)
| 177 | } |
| 178 | |
| 179 | func (w *errorResponseWriter) WriteHeader(status int) { |
| 180 | if status >= http.StatusBadRequest { |
| 181 | // charset=utf-8 is the default. No need to write it explicitly |
| 182 | // Must set all the headers before calling super.WriteHeader() |
| 183 | w.ResponseWriter.Header().Set("Content-Type", "application/json") |
| 184 | } |
| 185 | w.status = status |
| 186 | w.ResponseWriter.WriteHeader(status) |
| 187 | } |
| 188 | |
| 189 | func (w *errorResponseWriter) Write(p []byte) (n int, err error) { |
| 190 | if w.status >= http.StatusBadRequest { |
no outgoing calls
no test coverage detected