MCPcopy
hub / github.com/rs/zerolog / WrapWriter

Function WrapWriter

hlog/internal/mutil/writer_proxy.go:32–46  ·  view source on GitHub ↗

WrapWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.

(w http.ResponseWriter)

Source from the content-addressed store, hash-verified

30// WrapWriter wraps an http.ResponseWriter, returning a proxy that allows you to
31// hook into various parts of the response process.
32func WrapWriter(w http.ResponseWriter) WriterProxy {
33 _, cn := w.(http.CloseNotifier)
34 _, fl := w.(http.Flusher)
35 _, hj := w.(http.Hijacker)
36 _, rf := w.(io.ReaderFrom)
37
38 bw := basicWriter{ResponseWriter: w}
39 if cn && fl && hj && rf {
40 return &fancyWriter{bw}
41 }
42 if fl {
43 return &flushWriter{bw}
44 }
45 return &bw
46}
47
48// basicWriter wraps a http.ResponseWriter that implements the minimal
49// http.ResponseWriter interface.

Callers 1

AccessHandlerFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected