Documentation ¶
Index ¶
- type Client
- func (client *Client) Do(c context.Context, req *xhttp.Request) (res []byte, resp *xhttp.Response, err error)
- func (client *Client) Get(c context.Context, uri string, headers xhttp.Header) ([]byte, *xhttp.Response, error)
- func (client *Client) JSON(c context.Context, req *xhttp.Request, res interface{}) (resp *xhttp.Response, err error)
- func (client *Client) NewRequest(method, uri string, values url.Values, headers xhttp.Header) (req *xhttp.Request, err error)
- func (client *Client) Post(c context.Context, uri string, values url.Values, headers xhttp.Header) ([]byte, *xhttp.Response, error)
- func (client *Client) Raw(c context.Context, req *xhttp.Request) (bs []byte, resp *xhttp.Response, err error)
- func (client *Client) SetConfig(c *ClientConfig)
- func (client *Client) SetProxy(proxyURL string)
- type ClientConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is http client.
func (*Client) Do ¶
func (client *Client) Do(c context.Context, req *xhttp.Request) (res []byte, resp *xhttp.Response, err error)
Do sends an HTTP request and returns
func (*Client) Get ¶
func (client *Client) Get(c context.Context, uri string, headers xhttp.Header) ([]byte, *xhttp.Response, error)
Get issues a GET to the specified URL.
func (*Client) JSON ¶
func (client *Client) JSON(c context.Context, req *xhttp.Request, res interface{}) (resp *xhttp.Response, err error)
JSON sends an HTTP request and returns an HTTP json response.
func (*Client) NewRequest ¶
func (client *Client) NewRequest(method, uri string, values url.Values, headers xhttp.Header) (req *xhttp.Request, err error)
NewRequest new http request with method, uri, ip, values and headers.
func (*Client) Post ¶
func (client *Client) Post(c context.Context, uri string, values url.Values, headers xhttp.Header) ([]byte, *xhttp.Response, error)
Post issues a POST to the specified URL.
func (*Client) Raw ¶
func (client *Client) Raw(c context.Context, req *xhttp.Request) (bs []byte, resp *xhttp.Response, err error)
Raw sends an HTTP request and returns bytes response
func (*Client) SetConfig ¶
func (client *Client) SetConfig(c *ClientConfig)
SetConfig set client config.
Click to show internal directories.
Click to hide internal directories.