MCPcopy
hub / github.com/cortesi/devd / Write

Method Write

responselogger.go:62–69  ·  view source on GitHub ↗

Write writes the data to the connection as part of an HTTP reply. 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

(data []byte)

Source from the content-addressed store, hash-verified

60// Content-Type line, Write adds a Content-Type set to the result of passing
61// the initial 512 bytes of written data to DetectContentType.
62func (rl *ResponseLogWriter) Write(data []byte) (int, error) {
63 if !rl.wroteHeader {
64 rl.WriteHeader(http.StatusOK)
65 }
66 ret, err := rl.Resp.Write(data)
67 rl.Timer.ResponseDone()
68 return ret, err
69}
70
71// WriteHeader sends an HTTP response header with status code.
72// If WriteHeader is not called explicitly, the first call to Write

Callers

nothing calls this directly

Calls 2

WriteHeaderMethod · 0.95
ResponseDoneMethod · 0.80

Tested by

no test coverage detected