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

Method WriteResponse

modules/caddyhttp/responsewriter.go:225–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223}
224
225func (rr *responseRecorder) WriteResponse() error {
226 if rr.statusCode == 0 {
227 // could happen if no handlers actually wrote anything,
228 // and this prevents a panic; status must be > 0
229 rr.WriteHeader(http.StatusOK)
230 }
231 if rr.stream {
232 return nil
233 }
234 rr.ResponseWriterWrapper.WriteHeader(rr.statusCode)
235 _, err := io.Copy(rr.ResponseWriterWrapper, rr.buf)
236 return err
237}
238
239// FlushError will suppress actual flushing if the response is buffered. See:
240// https://github.com/caddyserver/caddy/issues/6144

Callers

nothing calls this directly

Calls 1

WriteHeaderMethod · 0.95

Tested by

no test coverage detected