()
| 223 | } |
| 224 | |
| 225 | func (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 |
nothing calls this directly
no test coverage detected