MCPcopy
hub / github.com/go-chi/chi / WrapResponseWriter

Interface WrapResponseWriter

middleware/wrap_writer.go:48–69  ·  middleware/wrap_writer.go::WrapResponseWriter

WrapResponseWriter is a proxy around an http.ResponseWriter that allows you to hook into various parts of the response process.

Source from the content-addressed store, hash-verified

46// WrapResponseWriter is a proxy around an http.ResponseWriter that allows you to hook
47// into various parts of the response process.
48type WrapResponseWriter interface {
49 http.ResponseWriter
50 // Status returns the HTTP status of the request, or 0 if one has not
51 // yet been sent.
52 Status() int
53 // BytesWritten returns the total number of bytes sent to the client.
54 BytesWritten() int
55 // Tee causes the response body to be written to the given io.Writer in
56 // addition to proxying the writes through. Only one io.Writer can be
57 // tee'd to at once: setting a second one will overwrite the first.
58 // Writes will be sent to the proxy before being written to this
59 // io.Writer. It is illegal for the tee'd writer to be modified
60 // concurrently with writes.
61 Tee(io.Writer)
62 // Unwrap returns the original proxied target.
63 Unwrap() http.ResponseWriter
64 // Discard causes all writes to the original ResponseWriter be discarded,
65 // instead writing only to the tee'd writer if it's set.
66 // The caller is responsible for calling WriteHeader and Write on the
67 // original ResponseWriter once the processing is done.
68 Discard()
69}
70
71// basicWriter wraps a http.ResponseWriter that implements the minimal
72// http.ResponseWriter interface.

Callers 7

RequestLoggerFunction · 0.95
PresentErrorFunction · 0.65
CreateArticleFunction · 0.65
RenderMethod · 0.65
RequestLoggerFunction · 0.95

Implementers 1

basicWritermiddleware/wrap_writer.go

Calls

no outgoing calls

Tested by

no test coverage detected