resty

package
v1.1.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewClient

func NewClient(ctx context.Context, plugins ...Plugin) (*resty.Client, error)

NewClient returns a new resty Client.

func NewClientWithConfigPath

func NewClientWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*resty.Client, error)

NewClientWithConfigPath returns a new resty Client with options from config path.

func NewClientWithOptions

func NewClientWithOptions(ctx context.Context, options *Options, plugins ...Plugin) *resty.Client

NewClientWithOptions returns a new resty Client with options.

Types

type Options

type Options struct {
	Debug             bool
	ConnectionTimeout time.Duration
	CloseConnection   bool
	KeepAlive         time.Duration
	RequestTimeout    time.Duration
	FallbackDelay     time.Duration
	Transport         OptionsTransport
	Host              string
}

Options represents resty client options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals options based a given key path.

type OptionsTransport

type OptionsTransport struct {
	DisableCompression    bool
	DisableKeepAlives     bool
	MaxIdleConnsPerHost   int
	ResponseHeaderTimeout time.Duration
	ForceAttemptHTTP2     bool `config:"forceAttemptHTTP2"`
	MaxIdleConns          int
	MaxConnsPerHost       int
	IdleConnTimeout       time.Duration
	TLSHandshakeTimeout   time.Duration
	ExpectContinueTimeout time.Duration
}

OptionsTransport represents resty transport options.

type Plugin

type Plugin func(context.Context, *resty.Client) error

Plugin defines a function to process plugin.

Jump to

Keyboard shortcuts

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