Documentation
¶
Index ¶
- func CONNECT(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
- func DELETE(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
- func Exec(handler http.Handler, method, pathQuery string, body io.Reader, ...) *httptest.ResponseRecorder
- func GET(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
- func HEAD(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
- func OPTIONS(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
- func PATCH(handler http.Handler, pathQuery string, body io.Reader, ...) *httptest.ResponseRecorder
- func POST(handler http.Handler, pathQuery string, body io.Reader, ...) *httptest.ResponseRecorder
- func PUT(handler http.Handler, pathQuery string, body io.Reader, ...) *httptest.ResponseRecorder
- func TRACE(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
- type HTTPTester
- func (t *HTTPTester) Connect(pathQuery string, requestOptions ...RequestOption) (http.Header, error)
- func (t *HTTPTester) Delete(pathQuery string, result any, requestOptions ...RequestOption) error
- func (t *HTTPTester) Get(pathQuery string, result any, requestOptions ...RequestOption) error
- func (t *HTTPTester) Head(pathQuery string, requestOptions ...RequestOption) (http.Header, error)
- func (t *HTTPTester) Options(pathQuery string, requestOptions ...RequestOption) (http.Header, error)
- func (t *HTTPTester) Patch(pathQuery string, body, result any, contentType string, ...) error
- func (t *HTTPTester) Post(pathQuery string, body, result any, contentType string, ...) error
- func (t *HTTPTester) Put(pathQuery string, body, result any, contentType string, ...) error
- func (t *HTTPTester) Trace(pathQuery string, requestOptions ...RequestOption) (*httptest.ResponseRecorder, error)
- type RequestOption
- type TesterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CONNECT ¶
func CONNECT(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
func DELETE ¶
func DELETE(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
func Exec ¶
func Exec(handler http.Handler, method, pathQuery string, body io.Reader, requestOptions ...RequestOption) *httptest.ResponseRecorder
func GET ¶
func GET(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
GET simulates a Get request
func HEAD ¶
func HEAD(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
func OPTIONS ¶
func OPTIONS(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
func PATCH ¶
func PATCH(handler http.Handler, pathQuery string, body io.Reader, requestOptions ...RequestOption) *httptest.ResponseRecorder
func POST ¶
func POST(handler http.Handler, pathQuery string, body io.Reader, requestOptions ...RequestOption) *httptest.ResponseRecorder
Post simulates a POST request
func PUT ¶
func PUT(handler http.Handler, pathQuery string, body io.Reader, requestOptions ...RequestOption) *httptest.ResponseRecorder
func TRACE ¶
func TRACE(handler http.Handler, pathQuery string, requestOptions ...RequestOption) *httptest.ResponseRecorder
Types ¶
type HTTPTester ¶
type HTTPTester struct {
// contains filtered or unexported fields
}
func New ¶
func New(handler http.Handler, options ...TesterOption) *HTTPTester
New creates an extended http tester object that is able to encode and decode bodys
func (*HTTPTester) Connect ¶
func (t *HTTPTester) Connect(pathQuery string, requestOptions ...RequestOption) (http.Header, error)
func (*HTTPTester) Delete ¶
func (t *HTTPTester) Delete(pathQuery string, result any, requestOptions ...RequestOption) error
func (*HTTPTester) Get ¶
func (t *HTTPTester) Get(pathQuery string, result any, requestOptions ...RequestOption) error
func (*HTTPTester) Head ¶
func (t *HTTPTester) Head(pathQuery string, requestOptions ...RequestOption) (http.Header, error)
func (*HTTPTester) Options ¶
func (t *HTTPTester) Options(pathQuery string, requestOptions ...RequestOption) (http.Header, error)
func (*HTTPTester) Patch ¶
func (t *HTTPTester) Patch(pathQuery string, body, result any, contentType string, requestOptions ...RequestOption) error
func (*HTTPTester) Post ¶
func (t *HTTPTester) Post(pathQuery string, body, result any, contentType string, requestOptions ...RequestOption) error
func (*HTTPTester) Put ¶
func (t *HTTPTester) Put(pathQuery string, body, result any, contentType string, requestOptions ...RequestOption) error
func (*HTTPTester) Trace ¶
func (t *HTTPTester) Trace(pathQuery string, requestOptions ...RequestOption) (*httptest.ResponseRecorder, error)
type RequestOption ¶
func WithAddHeader ¶
func WithAddHeader(key, value string) RequestOption
WithAddHeader adds a header without overwriting an existing header
func WithContentType ¶
func WithContentType(contentType string) RequestOption
WithAddHeader adds a header without overwriting an existing header
func WithHeaders ¶
func WithHeaders(headers map[string]string) RequestOption
WithHeaders overwrites existing headers with the key value pars from the map
func WithMultiHeaders ¶
func WithMultiHeaders(headers http.Header) RequestOption
WithMultiHeaders allows to set multi value headers
func WithSetHeader ¶
func WithSetHeader(key, value string) RequestOption
WithAddHeader sets a header overwriting an existing header
type TesterOption ¶
type TesterOption func(*HTTPTester)
func WithFallbackPickle ¶
func WithFallbackPickle(pickle pickle.Pickle) TesterOption
func WithPickle ¶
func WithPickle(pickle pickle.Pickle) TesterOption
func WithPickleJar ¶
func WithPickleJar(pickle map[string]pickle.Pickle) TesterOption
func WithRequestOptions ¶
func WithRequestOptions(options ...RequestOption) TesterOption
Click to show internal directories.
Click to hide internal directories.