Documentation ¶
Overview ¶
Package httprecorder provides a simple way of recording and later retrieving all requests that are sent to an HTTP handler.
If you are writing an HTTP client for an external dependency, this is likely what you need to test it is sending the right payloads, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IgnoreHeaders ¶
func OnlyHeaders ¶
Types ¶
type Request ¶
func (*Request) StringBody ¶
type RequestRecorder ¶
type RequestRecorder struct {
// contains filtered or unexported fields
}
func New ¶
func New() *RequestRecorder
func (*RequestRecorder) AllRequests ¶
func (r *RequestRecorder) AllRequests() []Request
func (*RequestRecorder) FindRequests ¶
func (r *RequestRecorder) FindRequests(method string, u url.URL) []Request
func (*RequestRecorder) LastRequest ¶
func (r *RequestRecorder) LastRequest() *Request
func (*RequestRecorder) Record ¶
func (r *RequestRecorder) Record(request *http.Request) (err error)
Record stores a copy of the incoming request ensuring the body can still be consumed by the caller
func (*RequestRecorder) Reset ¶
func (r *RequestRecorder) Reset()
Click to show internal directories.
Click to hide internal directories.