Documentation ¶
Index ¶
- func Gunzip(v []byte) []byte
- func Gzip(v []byte) []byte
- type Executor
- type HttpResponseRecorder
- func (rec *HttpResponseRecorder) Body() []byte
- func (rec *HttpResponseRecorder) BodyString() string
- func (rec *HttpResponseRecorder) Flush()
- func (rec *HttpResponseRecorder) FlushWith(bytes []byte)
- func (rec *HttpResponseRecorder) Header() http.Header
- func (rec *HttpResponseRecorder) Status() int
- func (rec *HttpResponseRecorder) Write(b []byte) (int, error)
- func (rec *HttpResponseRecorder) WriteHeader(s int)
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Executor ¶
type Executor interface { Post(url string, req, resp interface{}) error Put(url string, req, resp interface{}) error NewReq(method string, url string, req interface{}) (*http.Request, error) Execute(req *http.Request, resp interface{}) (*http.Response, error) }
func NewExecutor ¶
type HttpResponseRecorder ¶
type HttpResponseRecorder struct { http.ResponseWriter // contains filtered or unexported fields }
HttpResponseRecorder is wrapper of http.ResponseWriter
func Recorder ¶
func Recorder(w http.ResponseWriter) *HttpResponseRecorder
Create a new http response recorder that can be used to copy the response, status code and headers.
func (*HttpResponseRecorder) Body ¶
func (rec *HttpResponseRecorder) Body() []byte
A convenient method for extracting the recorded bytes. Note that if the content is encoded it will be decoded.
func (*HttpResponseRecorder) BodyString ¶
func (rec *HttpResponseRecorder) BodyString() string
A convenient method for extracting the recorded bytes in a string format. Note that if the content is encoded it will be decoded.
func (*HttpResponseRecorder) Flush ¶
func (rec *HttpResponseRecorder) Flush()
Write the copied body to the original http.ResponseWriter.
func (*HttpResponseRecorder) FlushWith ¶
func (rec *HttpResponseRecorder) FlushWith(bytes []byte)
Write the provided bytes to the original http.ResponseWriter.
func (*HttpResponseRecorder) Header ¶
func (rec *HttpResponseRecorder) Header() http.Header
func (*HttpResponseRecorder) Status ¶
func (rec *HttpResponseRecorder) Status() int
Return the recorded status.
func (*HttpResponseRecorder) WriteHeader ¶
func (rec *HttpResponseRecorder) WriteHeader(s int)
Click to show internal directories.
Click to hide internal directories.