Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Delete(url string, params io.Reader, headers ...http.Header) *Response
- func (c *Client) Do(req *Request) *Response
- func (c *Client) Get(url string, headers ...http.Header) *Response
- func (c *Client) GetCookie(key, value string) (string, error)
- func (c *Client) NewRequest(method, url string, body io.Reader, headers ...http.Header) *Request
- func (c *Client) Post(url string, params io.Reader, headers ...http.Header) *Response
- func (c *Client) Put(url string, params io.Reader, headers ...http.Header) *Response
- func (c *Client) SetCookie(key, value string) error
- func (c *Client) SetCookieJar(jar cookiejar.Jar) *Client
- type ClientOptions
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var BaseHeader = http.Header{ "User-Agent": []string{"xlib/http " + version}, "Connection": []string{"keep-alive"}, "Accept": []string{"application/json"}, }
BaseHeader xlib/http client header
View Source
var Cli = &Client{&http.Client{}}
Cli is a global http.Client
View Source
var ( // Debug flag Debug = false )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client extends http.Client
func (*Client) NewRequest ¶
NewRequest returns a Request extends http.Request with Client
type ClientOptions ¶
type ClientOptions struct { Timeout time.Duration RoundTripper http.RoundTripper Jar http.CookieJar CheckRedirect func(req *http.Request, via []*http.Request) error }
ClientOptions describe the options of a Client
type Request ¶
Request is a http request client
func NewRequest ¶
NewRequest returns a Request extends http.Request using global http.client 'Cli'
func (*Request) SetBasicAuth ¶
SetBasicAuth for request.
type Response ¶
Response base on http.Response
func (*Response) JSONUnmarshal ¶
JSONUnmarshal decode response body content to v
Source Files ¶
Click to show internal directories.
Click to hide internal directories.