Documentation ¶
Index ¶
- Constants
- func Backend(backend int) error
- func Get(url string) (*http.Response, error)
- func Head(url string) (*http.Response, error)
- func Post(url string, contentType string, body io.Reader) (*http.Response, error)
- func PostForm(url string, data url.Values) (*http.Response, error)
- type Client
- type HTTPClient
Constants ¶
View Source
const ( HTTPBackend = iota // Default on non-Windows WinHTTPBackend WinINetBackend // Default on Windows )
Supported backends
View Source
const Version string = "0.4.4"
Version is the package version
Variables ¶
This section is empty.
Functions ¶
func Backend ¶
Backend is used to track the preferred backend HTTP client. Only net/http is supported for non-Windows OS.
Types ¶
type Client ¶
type Client interface { Debug(enable bool) Client Do(req *http.Request) (*http.Response, error) Get(url string) (*http.Response, error) Head(url string) (*http.Response, error) Jar(jar http.CookieJar) Client Post( url string, contentType string, body io.Reader, ) (*http.Response, error) PostForm(url string, data url.Values) (*http.Response, error) Timeout(timeout time.Duration) Client Transport(trans *http.Transport) Client }
Client is an interface defining required functions for an HTTP client.
var ( // DefaultClient points to the default Client for the current // backend. DefaultClient Client )
type HTTPClient ¶
HTTPClient is a simple wrapper around net/http that adds the Jar(http.CookieJar) method for the Client interface.
func (*HTTPClient) Debug ¶ added in v0.4.0
func (c *HTTPClient) Debug(enable bool) Client
Debug will enable debugging/logging of Requests/Responses.
func (*HTTPClient) Do ¶ added in v0.4.0
Do is a wrapper around net/http.Client.Do which allows for debugging of Requests/Responses.
func (*HTTPClient) Jar ¶
func (c *HTTPClient) Jar(jar http.CookieJar) Client
Jar will set the cookiejar for the underlying http.Client.
Click to show internal directories.
Click to hide internal directories.