MCPcopy
hub / github.com/go-chi/chi / WriteHeader

Method WriteHeader

middleware/wrap_writer.go:82–94  ·  view source on GitHub ↗
(code int)

Source from the content-addressed store, hash-verified

80}
81
82func (b *basicWriter) WriteHeader(code int) {
83 if code >= 100 && code <= 199 && code != http.StatusSwitchingProtocols {
84 if !b.discard {
85 b.ResponseWriter.WriteHeader(code)
86 }
87 } else if !b.wroteHeader {
88 b.code = code
89 b.wroteHeader = true
90 if !b.discard {
91 b.ResponseWriter.WriteHeader(code)
92 }
93 }
94}
95
96func (b *basicWriter) Write(buf []byte) (n int, err error) {
97 b.maybeWriteHeader()

Callers 15

maybeWriteHeaderMethod · 0.95
methodNotAllowedHandlerFunction · 0.45
TestMuxBasicFunction · 0.45
TestMuxPlainFunction · 0.45
TestMuxTrailingSlashFunction · 0.45
TestMuxNestedNotFoundFunction · 0.45
TestMuxMissingParamsFunction · 0.45
TestEscapedURLParamsFunction · 0.45
mainFunction · 0.45
ServeHTTPMethod · 0.45

Calls

no outgoing calls

Tested by 15

TestMuxBasicFunction · 0.36
TestMuxPlainFunction · 0.36
TestMuxTrailingSlashFunction · 0.36
TestMuxNestedNotFoundFunction · 0.36
TestMuxMissingParamsFunction · 0.36
TestEscapedURLParamsFunction · 0.36
TestRouteHeadersFunction · 0.36
TestURLFormatFunction · 0.36
TestStripSlashesFunction · 0.36
TestStripSlashesInRouteFunction · 0.36