MCPcopy Index your code
hub / github.com/tailscale/tailscale / WriteHeader

Method WriteHeader

tempfork/httprec/httprec.go:139–151  ·  view source on GitHub ↗

WriteHeader implements [http.ResponseWriter].

(code int)

Source from the content-addressed store, hash-verified

137
138// WriteHeader implements [http.ResponseWriter].
139func (rw *ResponseRecorder) WriteHeader(code int) {
140 if rw.wroteHeader {
141 return
142 }
143
144 checkWriteHeaderCode(code)
145 rw.Code = code
146 rw.wroteHeader = true
147 if rw.HeaderMap == nil {
148 rw.HeaderMap = make(http.Header)
149 }
150 rw.snapHeader = rw.HeaderMap.Clone()
151}
152
153// Flush implements [http.Flusher]. To test whether Flush was
154// called, see rw.Flushed.

Callers 15

writeHeaderMethod · 0.95
FlushMethod · 0.95
TestRegisterWithoutKeyFunction · 0.45
TestAuthorizeFunction · 0.45
TestAuthorizeValidFunction · 0.45
TestWaitAuthorizationFunction · 0.45
TestRevokeAuthorizationFunction · 0.45
TestFetchCertCancelFunction · 0.45
TestFetchCertDepthFunction · 0.45
TestNonce_fetchFunction · 0.45
TestNonce_fetchErrorFunction · 0.45
TestRFC_popNonceFunction · 0.45

Calls 2

checkWriteHeaderCodeFunction · 0.85
CloneMethod · 0.65

Tested by 15

TestRegisterWithoutKeyFunction · 0.36
TestAuthorizeFunction · 0.36
TestAuthorizeValidFunction · 0.36
TestWaitAuthorizationFunction · 0.36
TestRevokeAuthorizationFunction · 0.36
TestFetchCertCancelFunction · 0.36
TestFetchCertDepthFunction · 0.36
TestNonce_fetchFunction · 0.36
TestNonce_fetchErrorFunction · 0.36
TestRFC_popNonceFunction · 0.36
TestRFC_postKIDFunction · 0.36
startMethod · 0.36