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

Method WriteHeader

responselogger.go:76–83  ·  view source on GitHub ↗

WriteHeader sends an HTTP response header with status code. If WriteHeader is not called explicitly, the first call to Write will trigger an implicit WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly used to send error codes.

(code int)

Source from the content-addressed store, hash-verified

74// Thus explicit calls to WriteHeader are mainly used to
75// send error codes.
76func (rl *ResponseLogWriter) WriteHeader(code int) {
77 rl.wroteHeader = true
78 rl.logCode(code, http.StatusText(code))
79 LogHeader(rl.Log, rl.Resp.Header())
80 rl.Timer.ResponseHeaders()
81 rl.Resp.WriteHeader(code)
82 rl.Timer.ResponseDone()
83}
84
85func (rl *ResponseLogWriter) Flush() {
86 if rl.Flusher != nil {

Callers 10

WriteMethod · 0.95
HandleNotFoundFunction · 0.80
ServeTemplateMethod · 0.80
TestReverseProxyFunction · 0.80
TestXForwardedForFunction · 0.80
ServeHTTPContextMethod · 0.80
serveContentFunction · 0.80
checkLastModifiedFunction · 0.80
checkETagFunction · 0.80
localRedirectFunction · 0.80

Calls 5

logCodeMethod · 0.95
LogHeaderFunction · 0.85
HeaderMethod · 0.80
ResponseHeadersMethod · 0.80
ResponseDoneMethod · 0.80

Tested by 2

TestReverseProxyFunction · 0.64
TestXForwardedForFunction · 0.64