Write writes to the client If WriteHeader has not yet been called, Write calls WriteHeader(http.StatusOK) before writing the data. If the Header does not contain a Content-Type line, Write adds a Content-Type set to the result of passing the initial 512 bytes of written data to DetectContentType. D
(contents []byte)
| 272 | // by all HTTP/2 clients. Handlers should read before writing if |
| 273 | // possible to maximize compatibility. |
| 274 | func (w *responseWriter) Write(contents []byte) (int, error) { |
| 275 | w.tryWriteHeader() |
| 276 | n, err := w.ResponseWriter.Write(contents) |
| 277 | w.written += n |
| 278 | return n, err |
| 279 | } |
| 280 | |
| 281 | // StatusCode returns the status code header value |
| 282 | func (w *responseWriter) StatusCode() int { |
no test coverage detected