http

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeRequest

func MakeRequest(t testing.TB, method, uri string, modifiers ...RequestModifier) *http.Request

Types

type ExtendedResponse added in v1.0.0

type ExtendedResponse[T any] struct {
	*http.Response
}

func Delete

func Delete[TSender RequestSender[any]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[any]

func DeleteWithResponbe added in v1.0.0

func DeleteWithResponbe[TRes any, TSender RequestSender[TRes]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[TRes]

func Get

func Get[TSender RequestSender[any]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[any]

func GetWithResponse added in v1.0.0

func GetWithResponse[TRes any, TSender RequestSender[TRes]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[TRes]

func Patch

func Patch[TSender RequestSender[any]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[any]

func PatchWithResponse added in v1.0.0

func PatchWithResponse[TRes any, TSender RequestSender[TRes]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[TRes]

func Post

func Post[TSender RequestSender[any]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[any]

func PostWithResponse added in v1.0.0

func PostWithResponse[TRes any, TSender RequestSender[TRes]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[TRes]

func Put

func Put[TSender RequestSender[any]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[any]

func PutWithResponse added in v1.0.0

func PutWithResponse[TRes any, TSender RequestSender[TRes]](t testing.TB, app TSender, uri string, modifiers ...RequestModifier) ExtendedResponse[TRes]

func (ExtendedResponse[T]) AssertHeader added in v1.0.0

func (e ExtendedResponse[T]) AssertHeader(t testing.TB, header, value string)

func (ExtendedResponse[T]) AssertStatusCode added in v1.0.0

func (e ExtendedResponse[T]) AssertStatusCode(t testing.TB, status int)

func (ExtendedResponse[T]) Data added in v1.0.0

func (e ExtendedResponse[T]) Data(tb testing.TB) T

type RequestModifier

type RequestModifier func(*http.Request) *http.Request

func WithBody

func WithBody[T any](t testing.TB, body T) RequestModifier

func WithCookies

func WithCookies(t testing.TB, cookies []*http.Cookie) RequestModifier

func WithHeaders

func WithHeaders(t testing.TB, headers http.Header) RequestModifier

func WithQuery

func WithQuery(t testing.TB, queryMap map[string]string) RequestModifier

type RequestSender

type RequestSender[T any] interface {
	Test(req *http.Request, timeout ...time.Duration) ExtendedResponse[T]
}

Jump to

Keyboard shortcuts

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