MCPcopy
hub / github.com/caddyserver/caddy / WriteHeader

Method WriteHeader

modules/caddyhttp/headers/headers.go:387–401  ·  view source on GitHub ↗
(status int)

Source from the content-addressed store, hash-verified

385}
386
387func (rww *responseWriterWrapper) WriteHeader(status int) {
388 if rww.wroteHeader {
389 return
390 }
391 // 1xx responses aren't final; just informational
392 if status < 100 || status > 199 {
393 rww.wroteHeader = true
394 }
395 if rww.require == nil || rww.require.Match(status, rww.ResponseWriterWrapper.Header()) {
396 if rww.headerOps != nil {
397 rww.headerOps.ApplyTo(rww.ResponseWriterWrapper.Header(), rww.replacer)
398 }
399 }
400 rww.ResponseWriterWrapper.WriteHeader(status)
401}
402
403func (rww *responseWriterWrapper) Write(d []byte) (int, error) {
404 if !rww.wroteHeader {

Callers 3

WriteMethod · 0.95
TestHandlerFunction · 0.45

Calls 3

ApplyToMethod · 0.80
MatchMethod · 0.65
HeaderMethod · 0.45

Tested by 2

TestHandlerFunction · 0.36