http

package
v1.16.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssertableJSON

type AssertableJSON interface {
	Count(key string, value int) AssertableJSON
	First(key string, callback func(AssertableJSON)) AssertableJSON
	Each(key string, callback func(AssertableJSON)) AssertableJSON
	Has(key string) AssertableJSON
	HasAll(keys []string) AssertableJSON
	HasAny(keys []string) AssertableJSON
	HasWithScope(key string, length int, callback func(AssertableJSON)) AssertableJSON
	Json() map[string]any
	Missing(key string) AssertableJSON
	MissingAll(keys []string) AssertableJSON
	Where(key string, value any) AssertableJSON
	WhereNot(key string, value any) AssertableJSON
}

type Request

type Request interface {
	Get(uri string) (Response, error)
	Post(uri string, body io.Reader) (Response, error)
	Put(uri string, body io.Reader) (Response, error)
	Delete(uri string, body io.Reader) (Response, error)
	Patch(uri string, body io.Reader) (Response, error)
	Head(uri string) (Response, error)
	Options(uri string) (Response, error)

	Bind(value any) Request
	FlushHeaders() Request
	WithBasicAuth(username, password string) Request
	WithContext(ctx context.Context) Request
	WithCookies(cookies []*http.Cookie) Request
	WithCookie(cookie *http.Cookie) Request
	WithHeader(key, value string) Request
	WithHeaders(headers map[string]string) Request
	WithoutHeader(key string) Request
	WithToken(token string, ttype ...string) Request
	WithoutToken() Request
	WithSession(attributes map[string]any) Request
}

type Response

type Response interface {
	Content() (string, error)
	Cookie(name string) *http.Cookie
	Cookies() []*http.Cookie
	Headers() http.Header
	IsServerError() bool
	IsSuccessful() bool
	Json() (map[string]any, error)
	Session() (map[string]any, error)

	AssertStatus(status int) Response
	AssertOk() Response
	AssertCreated() Response
	AssertAccepted() Response
	AssertNoContent(status ...int) Response
	AssertMovedPermanently() Response
	AssertFound() Response
	AssertNotModified() Response
	AssertPartialContent() Response
	AssertTemporaryRedirect() Response
	AssertBadRequest() Response
	AssertUnauthorized() Response
	AssertPaymentRequired() Response
	AssertForbidden() Response
	AssertNotFound() Response
	AssertMethodNotAllowed() Response
	AssertNotAcceptable() Response
	AssertConflict() Response
	AssertRequestTimeout() Response
	AssertGone() Response
	AssertUnsupportedMediaType() Response
	AssertUnprocessableEntity() Response
	AssertTooManyRequests() Response
	AssertInternalServerError() Response
	AssertServiceUnavailable() Response
	AssertHeader(headerName, value string) Response
	AssertHeaderMissing(string) Response
	AssertCookie(name, value string) Response
	AssertCookieExpired(string) Response
	AssertCookieNotExpired(string) Response
	AssertCookieMissing(string) Response
	AssertSuccessful() Response
	AssertServerError() Response
	AssertDontSee([]string, ...bool) Response
	AssertSee([]string, ...bool) Response
	AssertSeeInOrder([]string, ...bool) Response
	AssertJson(map[string]any) Response
	AssertExactJson(map[string]any) Response
	AssertJsonMissing(map[string]any) Response
	AssertFluentJson(func(json AssertableJSON)) Response
}

Jump to

Keyboard shortcuts

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