goload_http

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(options ...HTTPTransportOption) *http.Client

NewClient creates a new http client for loadtesting with custom options.

It allows to specify various request options which will be applied to all requests.

func NewEndpoint

func NewEndpoint(opts ...EndpointOption) goload.Executor

func SetHTTPClient

func SetHTTPClient(client *http.Client)

func Status2xxResponseValidation

func Status2xxResponseValidation(response *http.Response) error

func WithBasePath

func WithBasePath(path string) goload.LoadTestOption

Types

type EndpointOption

type EndpointOption func(ep *endpoint)

func WithBodyFunc

func WithBodyFunc(bodyFunc func() (io.Reader, error)) EndpointOption

func WithClient

func WithClient(client http.Client) EndpointOption

func WithHeader

func WithHeader(header http.Header) EndpointOption

func WithHeaderFunc

func WithHeaderFunc(headerFunc func() (http.Header, error)) EndpointOption

func WithMethod

func WithMethod(method string) EndpointOption

func WithMethodFunc

func WithMethodFunc(methodFunc func() (string, error)) EndpointOption

func WithName

func WithName(name string) EndpointOption

func WithTimeout

func WithTimeout(timeout time.Duration) EndpointOption

func WithURL

func WithURL(rawURL string) EndpointOption

func WithURLBuilder

func WithURLBuilder(opts ...url_builder.URLBuilderOption) EndpointOption

func WithURLFunc

func WithURLFunc(urlFunc func() (*url.URL, error)) EndpointOption

func WithValidateResponse

func WithValidateResponse(validationFunc func(response *http.Response) error) EndpointOption

func WithWeight

func WithWeight(weight int) EndpointOption

type HTTPTransportOption

type HTTPTransportOption = func(request *http.Request)

func WithClientBasicAuth

func WithClientBasicAuth(username string, password string) HTTPTransportOption

WithClientBasicAuth sets basic auth credentials on each request.

func WithClientHeader

func WithClientHeader(key string, value string) HTTPTransportOption

WithClientHeader sets a custom header on each request.

func WithClientUserAgent

func WithClientUserAgent(userAgent string) HTTPTransportOption

WithClientUserAgent sets the user agent on each of the request

type HeaderFunc added in v0.3.1

type HeaderFunc func() (http.Header, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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