MCPcopy
hub / github.com/caddyserver/caddy / NewResponseRecorder

Function NewResponseRecorder

modules/caddyhttp/responsewriter.go:137–143  ·  view source on GitHub ↗

NewResponseRecorder returns a new ResponseRecorder that can be used instead of a standard http.ResponseWriter. The recorder is useful for middlewares which need to buffer a response and potentially process its entire body before actually writing the response to the underlying writer. Of course, buff

(w http.ResponseWriter, buf *bytes.Buffer, shouldBuffer ShouldBufferFunc)

Source from the content-addressed store, hash-verified

135// because they are not the final response; they are passed through
136// directly to the underlying ResponseWriter.
137func NewResponseRecorder(w http.ResponseWriter, buf *bytes.Buffer, shouldBuffer ShouldBufferFunc) ResponseRecorder {
138 return &responseRecorder{
139 ResponseWriterWrapper: &ResponseWriterWrapper{ResponseWriter: w},
140 buf: buf,
141 shouldBuffer: shouldBuffer,
142 }
143}
144
145// WriteHeader writes the headers with statusCode to the wrapped
146// ResponseWriter unless the response is to be buffered instead.

Callers 11

ServeHTTPMethod · 0.92
ServeHTTPMethod · 0.92
ServeHTTPMethod · 0.92
ServeHTTPMethod · 0.85
TestServer_LogRequestFunction · 0.85
ServeHTTPMethod · 0.85

Calls

no outgoing calls