writeRawJSONStatus writes the given bytes as a JSON response. If status is nonzero, the header will be written with that status.
(status int, b []byte)
| 1570 | // writeRawJSONStatus writes the given bytes as a JSON response. |
| 1571 | // If status is nonzero, the header will be written with that status. |
| 1572 | func (h *handler) writeRawJSONStatus(status int, b []byte) { |
| 1573 | if !h.requestAccepts("application/json") { |
| 1574 | base.WarnfCtx(h.ctx(), "Client won't accept JSON, only %s", h.rq.Header.Get("Accept")) |
| 1575 | h.writeStatus(http.StatusNotAcceptable, "only application/json available") |
| 1576 | return |
| 1577 | } |
| 1578 | |
| 1579 | h.writeRawJSONWithoutClientVerification(status, b) |
| 1580 | } |
| 1581 | |
| 1582 | // writeRawJSON writes the given bytes as a plaintext response with a 200 OK status. |
| 1583 | func (h *handler) writeText(value []byte) { |
no test coverage detected