Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseRecorder ¶
type ResponseRecorder struct {
// contains filtered or unexported fields
}
ResponseRecorder records the response of an HTTP request in a buffer.
Calls to Header, WriteHeader and Write are passed to original http.ResponseWriter used in constructor.
func NewResponseRecorder ¶
func NewResponseRecorder(w http.ResponseWriter, r *http.Request) *ResponseRecorder
NewResponseRecorder returns a new instance of write-through response recorder.
func (*ResponseRecorder) Body ¶
func (c *ResponseRecorder) Body() []byte
Body returns body content of recorded response.
func (*ResponseRecorder) Header ¶
func (c *ResponseRecorder) Header() http.Header
Header returns header of recorded response.
func (*ResponseRecorder) StatusCode ¶
func (c *ResponseRecorder) StatusCode() int
StatusCode returns status code of recorded response.
func (*ResponseRecorder) Write ¶
func (c *ResponseRecorder) Write(bytes []byte) (int, error)
Write should be called inside the HTTP handler.
func (*ResponseRecorder) WriteHeader ¶
func (c *ResponseRecorder) WriteHeader(statusCode int)
WriteHeader should be called inside the HTTP handler.
Click to show internal directories.
Click to hide internal directories.