Documentation
¶
Index ¶
- func New(config map[string]interface{}) (interface{}, error)
- type Client
- func (c *Client) ClientDo(req *http.Request) (*http.Response, error)
- func (c *Client) Do(req *http.Request, option ...*Option) (*http.Response, error)
- func (c *Client) Get(addr string, data interface{}, option ...*Option) (*http.Response, error)
- func (c *Client) HttpNewRequest(method, url string, body io.Reader) (*http.Request, error)
- func (c *Client) Init()
- func (c *Client) Post(addr string, data interface{}, option ...*Option) (*http.Response, error)
- func (c *Client) SetTimeout(v string) error
- func (c *Client) SetUserAgent(userAgent string)
- func (c *Client) SetVerifyPeer(verifyPeer bool)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Get ¶
Get perform a get request, and return a response pointer. addr is the request url. data is the params associated and will be append to addr if not empty, data type can be url.Values or map with string key. option is an optional configuration object to specify header, cookie etc.
func (*Client) HttpNewRequest ¶
func (*Client) Post ¶
Post perform a post request, and return a response pointer. addr is the request url. data is the params will be sent, data type can be url.Values, map with string key, string, []byte or io.Reader, if url.Values or map is specified, Content-Type header will be set to "application/x-www-form-urlencoded". option is an optional configuration object to specify header, cookie etc.