Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) ExportCookie(domain string) (jsonStr string, err error)
- func (c *Client) GetCookie(domain, name string) (value string, err error)
- func (c *Client) GetCookies(domain string) (cookies []*http.Cookie, err error)
- func (c *Client) ImportCookie(domain, jsonStr string) (err error)
- func (c *Client) Request(opt *Option) (data []byte, res *http.Response, err error)
- func (c *Client) SetCookies(domain string, cookies []*http.Cookie) (err error)
- func (c *Client) SetProxy(proxyURLStr string) (err error)
- func (c *Client) SetTimeout(timeout time.Duration)
- type Data
- type Header
- type Option
Constants ¶
View Source
const (
// DefaultTimeout is request timeout in second
DefaultTimeout = 180
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an http client that hold init settings and cookies
func NewNoCookie ¶
func NewNoCookie() *Client
NewNoCookie return a new Client that won't save cookies
func (*Client) ExportCookie ¶
ExportCookie exports client cookies as json stdlib cookie jar just export cookie name and value
func (*Client) GetCookie ¶
GetCookie gets cookie value by domain and cookie name stdlib cookie jar just export cookie name and value
func (*Client) GetCookies ¶
GetCookies gets []*http.Cookie by domain
func (*Client) ImportCookie ¶
ImportCookie imports cookie from json
func (*Client) SetCookies ¶
SetCookies sets cookies by domain
func (*Client) SetTimeout ¶
SetTimeout sets client timeout
type Option ¶
type Option struct { URL string // required Method string // default: "GET", anything "POST", "PUT", "DELETE" or "PATCH" BodyStr string Body *Data Form *Data // set Content-Type header as "application/x-www-form-urlencoded" JSON interface{} // set Content-Type header as "application/json" Query *Data QueryRaw string Header *Header }
Option holds all the #Request requirements
Click to show internal directories.
Click to hide internal directories.