MCPcopy Create free account
hub / github.com/kataras/iris / CopyTo

Method CopyTo

context/response_writer.go:315–330  ·  view source on GitHub ↗

CopyTo writes a response writer (temp: status code, headers and body) to another response writer.

(to ResponseWriter)

Source from the content-addressed store, hash-verified

313
314// CopyTo writes a response writer (temp: status code, headers and body) to another response writer.
315func (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.

Callers

nothing calls this directly

Calls 4

WriteHeaderMethod · 0.80
GetMethod · 0.65
HeaderMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected