requestconfig

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteNewRequest

func ExecuteNewRequest(ctx context.Context, method string, u string, body interface{}, dst interface{}, opts ...func(*RequestConfig) error) error

Types

type RequestConfig

type RequestConfig struct {
	MaxRetries     int
	RequestTimeout time.Duration
	Context        context.Context
	Request        *http.Request
	BaseURL        *url.URL
	HTTPClient     *http.Client
	Middlewares    []middleware
	APIKey         string
	WebhookSecret  string
	// If ResponseBodyInto not nil, then we will attempt to deserialize into
	// ResponseBodyInto. If Destination is a []byte, then it will return the body as
	// is.
	ResponseBodyInto interface{}
	// ResponseInto copies the \*http.Response of the corresponding request into the
	// given address
	ResponseInto **http.Response
	Body         io.Reader
}

RequestConfig represents all the state related to one request.

Editing the variables inside RequestConfig directly is unstable api. Prefer composing func(\*RequestConfig) error instead if possible.

func NewRequestConfig

func NewRequestConfig(ctx context.Context, method string, u string, body interface{}, dst interface{}, opts ...func(*RequestConfig) error) (*RequestConfig, error)

func (*RequestConfig) Apply

func (cfg *RequestConfig) Apply(opts ...func(*RequestConfig) error) error

func (*RequestConfig) Clone

func (cfg *RequestConfig) Clone(ctx context.Context) *RequestConfig

func (*RequestConfig) Execute

func (cfg *RequestConfig) Execute() (err error)

Jump to

Keyboard shortcuts

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