Documentation
¶
Index ¶
- type ResponseRecorder
- func (w *ResponseRecorder) BodyBytes() []byte
- func (w *ResponseRecorder) Failed() bool
- func (w *ResponseRecorder) MarkFailed()
- func (w *ResponseRecorder) StatusCode() int
- func (w *ResponseRecorder) Unwrap() http.ResponseWriter
- func (w *ResponseRecorder) Write(p []byte) (int, error)
- func (w *ResponseRecorder) WriteHeader(status int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseRecorder ¶
type ResponseRecorder struct {
http.ResponseWriter
// contains filtered or unexported fields
}
ResponseRecorder records response metadata for later inspection.
func NewResponseRecorder ¶
func NewResponseRecorder(w http.ResponseWriter) *ResponseRecorder
NewResponseRecorder wraps a response writer with status/body capture.
func (*ResponseRecorder) BodyBytes ¶
func (w *ResponseRecorder) BodyBytes() []byte
BodyBytes returns the buffered prefix of the response body.
func (*ResponseRecorder) Failed ¶ added in v0.6.0
func (w *ResponseRecorder) Failed() bool
func (*ResponseRecorder) MarkFailed ¶ added in v0.6.0
func (w *ResponseRecorder) MarkFailed()
MarkFailed records a post-commit transport failure that can no longer be represented by the HTTP status (for example an aborted SSE stream).
func (*ResponseRecorder) StatusCode ¶
func (w *ResponseRecorder) StatusCode() int
StatusCode returns the written status code, defaulting to 200 when none was set explicitly.
func (*ResponseRecorder) Unwrap ¶ added in v0.4.0
func (w *ResponseRecorder) Unwrap() http.ResponseWriter
func (*ResponseRecorder) WriteHeader ¶
func (w *ResponseRecorder) WriteHeader(status int)
Click to show internal directories.
Click to hide internal directories.