Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capture ¶ added in v1.4.0
type Capture struct {
// contains filtered or unexported fields
}
func CaptureResponse ¶ added in v1.4.0
CaptureResponse runs the given http.Handler and returns the captured response. To see headers, look at `w.Header()`, which will be mutated by the handler.
func NewCapture ¶ added in v1.4.0
func NewCapture() *Capture
NewCapture creates a ready-to-use Capture. You use it by calling `Wrap` on an `http.ResponseWriter`, using the result in a handler, then examining the capture StatusCode() and Body(). The convenience `CaptureResponse(...)` below does the above given the http.Handler, and hands you back the capture.
func (*Capture) StatusCode ¶ added in v1.4.0
func (*Capture) Wrap ¶ added in v1.4.0
func (c *Capture) Wrap(w http.ResponseWriter) http.ResponseWriter
Wrap creates a http.ResponseWriter which will capture the response in the method receiver so it can be examined after being used in a handler. Consider using `CaptureResponse()`, which does this for you.
type LoggingResponseWriter ¶
type LoggingResponseWriter struct {
http.ResponseWriter
*Capture
}
LoggingResponseWriter wraps a ResponseWriter in such a way that the response status code, body and headers can be examined after its been used to serve a response. This is deprecated: use Capture.Wrap(w) instead, because it wraps the ResponseWriter such that additional interfaces (e.g., io.ReaderFrom) that may be present on the supplied ResponseWriter are still supported in the wrapper.
func NewLoggingResponseWriter ¶
func NewLoggingResponseWriter(next http.ResponseWriter) *LoggingResponseWriter