CopyTo writes a response writer (temp: status code, headers and body) to another response writer.
(to ResponseWriter)
| 313 | |
| 314 | // CopyTo writes a response writer (temp: status code, headers and body) to another response writer. |
| 315 | func (w *responseWriter) CopyTo(to ResponseWriter) { |
| 316 | // set the status code, failure status code are first class |
| 317 | if w.statusCode >= 400 { |
| 318 | to.WriteHeader(w.statusCode) |
| 319 | } |
| 320 | |
| 321 | // append the headers |
| 322 | for k, values := range w.Header() { |
| 323 | for _, v := range values { |
| 324 | if to.Header().Get(v) == "" { |
| 325 | to.Header().Add(k, v) |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | // the body is not copied, this writer doesn't support recording |
| 330 | } |
| 331 | |
| 332 | // ErrHijackNotSupported is returned by the Hijack method to |
| 333 | // indicate that Hijack feature is not available. |
nothing calls this directly
no test coverage detected