httprecorder

package
v1.0.251-425c62f Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Method string
	URL    url.URL
	Header http.Header
	Body   []byte
}

func (*Request) Decode

func (r *Request) Decode(x interface{}) error

Decode decodes the JSON from the request into the supplied pointer

func (*Request) StringBody

func (r *Request) StringBody() string

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()

Jump to

Keyboard shortcuts

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