client

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetShortConnClient

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

Types

type Client

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

func (*Client) Do

func (c *Client) Do(operationID string, 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 {
	*Client
	*http.Response
	Err error
	// contains filtered or unexported fields
}

func (*Result) Into

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

type StatusError

type StatusError int
const (
	// request failed
	RequestFailed StatusError = http.StatusInternalServerError*1e6 + iota + 1
	// read failed
	ReadFailed
)
const (
	// transform request failed
	RequestTransformFailed StatusError = http.StatusBadRequest*1e6 + iota + 1
)

func (StatusError) CanBeTalkError

func (v StatusError) CanBeTalkError() bool

func (StatusError) Code

func (v StatusError) Code() int

func (StatusError) Error

func (v StatusError) Error() string

func (StatusError) Key

func (v StatusError) Key() string

func (StatusError) Msg

func (v StatusError) Msg() string

func (StatusError) StatusCode

func (v StatusError) StatusCode() int

func (StatusError) StatusErr

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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