responserecorder

package
v0.0.0-...-919b350 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL