Documentation ¶
Index ¶
- func CodecForResponse(r *http.Response) encoding.Codec
- func ContentSubtype(contentType string) string
- func DefaultErrorDecoder(ctx context.Context, res *http.Response) error
- func DefaultRequestEncoder(ctx context.Context, contentType string, in interface{}) ([]byte, error)
- func DefaultResponseDecoder(ctx context.Context, res *http.Response, v interface{}) error
- type Client
- func (client *Client) BuildRequest(ctx context.Context, method, path, contentType string, args interface{}) (*http.Request, error)
- func (client *Client) BuildResponse(ctx context.Context, res *http.Response, reply interface{}) error
- func (client *Client) Do(req *http.Request) (*http.Response, error)
- func (client *Client) Get(ctx context.Context, path string, reply interface{}) error
- func (client *Client) Invoke(ctx context.Context, method, path, contentType string, args interface{}, ...) error
- func (client *Client) Post(ctx context.Context, path string, contentType string, args, reply interface{}) error
- type ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithErrorDecoder(errorDecoder DecodeErrorFunc) ClientOption
- func WithRequestEncoder(encoder EncodeRequestFunc) ClientOption
- func WithResponseDecoder(decoder DecodeResponseFunc) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithTlsConfig(cfg *tls.Config) ClientOption
- func WithTransport(trans *http.Transport) ClientOption
- func WithUserAgent(userAgent string) ClientOption
- type DecodeErrorFunc
- type DecodeResponseFunc
- type EncodeRequestFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentSubtype ¶
ContentSubtype returns the content-subtype for the given content-type. The given content-type must be a valid content-type that starts with but no content-subtype will be returned. according rfc7231. contentType is assumed to be lowercase already.
func DefaultRequestEncoder ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
func (*Client) BuildRequest ¶
func (*Client) BuildResponse ¶
type ClientOption ¶
type ClientOption func(*clientOptions)
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOption
func WithErrorDecoder ¶
func WithErrorDecoder(errorDecoder DecodeErrorFunc) ClientOption
func WithRequestEncoder ¶
func WithRequestEncoder(encoder EncodeRequestFunc) ClientOption
func WithResponseDecoder ¶
func WithResponseDecoder(decoder DecodeResponseFunc) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
func WithTlsConfig ¶
func WithTlsConfig(cfg *tls.Config) ClientOption
func WithTransport ¶
func WithTransport(trans *http.Transport) ClientOption
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
type DecodeResponseFunc ¶
type EncodeRequestFunc ¶
Click to show internal directories.
Click to hide internal directories.