client

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFromContext added in v1.9.2

func ClientFromContext(ctx context.Context) *http.Client

func ContextWithClient added in v1.9.2

func ContextWithClient(ctx context.Context, c *http.Client) context.Context

func ContextWithDefaultHttpTransport added in v1.17.12

func ContextWithDefaultHttpTransport(ctx context.Context, t *http.Transport) context.Context

func DefaultHttpTransportFromContext added in v1.17.12

func DefaultHttpTransportFromContext(ctx context.Context) *http.Transport

func GetShortConnClient

func GetShortConnClient(timeout time.Duration, httpTransports ...HttpTransport) *http.Client

Deprecated use GetShortConnClientContext instead

func GetShortConnClientContext added in v1.17.12

func GetShortConnClientContext(ctx context.Context, timeout time.Duration, httpTransports ...HttpTransport) *http.Client

Types

type Client

type Client struct {
	Protocol              string
	Host                  string
	Port                  uint16
	Timeout               time.Duration
	RequestTransformerMgr *httptransport.RequestTransformerMgr
	HttpTransports        []HttpTransport
	NewError              func(resp *http.Response) error
}

func (*Client) Do

func (c *Client) Do(ctx context.Context, req interface{}, metas ...courier.Metadata) courier.Result

func (*Client) SetDefaults

func (c *Client) SetDefaults()

type HttpTransport

type HttpTransport func(rt http.RoundTripper) http.RoundTripper

type Result

type Result struct {
	TransformerMgr transformers.TransformerMgr
	Response       *http.Response
	NewError       func(resp *http.Response) error
	Err            error
}

func (*Result) Into

func (r *Result) Into(body interface{}) (courier.Metadata, error)

func (*Result) Meta added in v1.14.9

func (r *Result) Meta() courier.Metadata

func (*Result) StatusCode added in v1.14.8

func (r *Result) StatusCode() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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