http

package
v2.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 8 Imported by: 0

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

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

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

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

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

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

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

func (ExtendedResponse[T]) AssertHeader

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

func (ExtendedResponse[T]) AssertStatusCode

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

func (ExtendedResponse[T]) Data

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

type RequestModifier

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

func WithBearerToken

func WithBearerToken(t testing.TB, token string) RequestModifier

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