client

package
v1.1.0-rc4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

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 ContextWithDftTransport

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

func DftTransportFromContext

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

func GetShortConnClientContext

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

Types

type Client

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

func (*Client) Do

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

func (*Client) SetDefault

func (c *Client) SetDefault()

type HttpTransport

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

type Result

type Result struct {
	Tsfm     transformer.Factory
	Response *http.Response
	NewError func(resp *http.Response) error
	Err      error
}

func (*Result) Into

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

func (*Result) Meta

func (r *Result) Meta() kit.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