client

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFromContext

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

func ContextWithClient

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

func ContextWithDefaultHttpTransport

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

func DefaultHttpTransportFromContext

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

func GetShortConnClient

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

Deprecated use GetShortConnClientContext instead

func GetShortConnClientContext

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

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

func (*Result) StatusCode

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