Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
- func DumpInterceptor(req *http.Request, handler Handler) (*http.Response, error)
- func Get(url string, out interface{}) error
- func Post(url string, in, out interface{}) error
- func ResponseInterceptor(req *http.Request, handler Handler) (*http.Response, error)
- type Client
- func (c *Client) AddInterceptor(inter Interceptor) error
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Get(url string, out interface{}) error
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) Post(url string, in, out interface{}) error
- func (c *Client) SetAuthorization(auth string)
- func (c *Client) SetHeader(key, value string)
- type ClientOpt
- type ErrorResponse
- type Handler
- type Interceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
func DoRequestWithClient ¶
func DumpInterceptor ¶ added in v0.2.0
DumpInterceptor logs dump request and response
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL Headers map[string]string // contains filtered or unexported fields }
func (*Client) AddInterceptor ¶ added in v0.2.0
func (c *Client) AddInterceptor(inter Interceptor) error
func (*Client) NewRequest ¶
func (*Client) SetAuthorization ¶ added in v0.4.0
type ClientOpt ¶
func WithAuthorization ¶ added in v0.4.0
func WithBaseURL ¶ added in v0.4.0
func WithInterceptor ¶ added in v0.4.0
func WithInterceptor(inter Interceptor) ClientOpt
func WithUserAgent ¶ added in v0.4.0
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Click to show internal directories.
Click to hide internal directories.