Documentation ¶
Index ¶
- Variables
- func Delete(url string) error
- func GetBytes(url string) ([]byte, error)
- func GetJSON(url string, out interface{}) error
- func GetString(url string) (string, error)
- func Head(url string) error
- type Client
- func (c *Client) Delete(path string, headers map[string]string) error
- func (c *Client) Do(req *Request) (*Response, error)
- func (c *Client) DoWithStatus(req *Request, expectedStatus int) (*Response, error)
- func (c *Client) GetBytes(path string, headers map[string]string) ([]byte, error)
- func (c *Client) GetJSON(path string, headers map[string]string, out interface{}) error
- func (c *Client) GetString(path string, headers map[string]string) (string, error)
- func (c *Client) Head(path string, headers map[string]string) error
- func (c *Client) PostBytes(path string, headers map[string]string, in []byte) ([]byte, error)
- func (c *Client) PostJSON(path string, headers map[string]string, in, out interface{}) error
- func (c *Client) SetBaseURL(url string) *Client
- func (c *Client) SetHeaders(headers map[string]string) *Client
- func (c *Client) SetTimeout(timeout time.Duration) *Client
- func (c *Client) SetTransport(transport *http.Transport) *Client
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = New()
DefaultClient is a basic Client for use without needing to define a Client
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an http.Client wrapper
func (*Client) Delete ¶
Delete performs a DELETE request using the passed path and headers. It expects a 200 code status in the response
func (*Client) DoWithStatus ¶
DoWithStatus performs the request and asserts the status code on the response
func (*Client) GetBytes ¶
GetBytes performs a GET request using the passed path and headers. It expects a 200 code status in the response and returns the bytes on the response
func (*Client) GetJSON ¶
GetJSON performs a basic http GET request and decodes the JSON response into the out interface
func (*Client) Head ¶
Head performs a HEAD request using the passed path and headers. It expects a 200 status code in the response
func (*Client) PostBytes ¶
PostBytes performs a POST request using the passed path, headers and body. It expects a 200 code status in the response and returns the bytes on the response
func (*Client) PostJSON ¶
PostJSON performs a basic http POST request and decodes the JSON response into the out interface
func (*Client) SetBaseURL ¶
SetBaseURL sets the baseURL on the Client which will be used on all subsequent requests
func (*Client) SetHeaders ¶
SetHeaders sets the headers on the Client which will be used on all subsequent requests
func (*Client) SetTimeout ¶
SetTimeout sets the timeout on the httpclients client
type Request ¶
Request is a basic HTTP request struct containing just what is needed to perform a standard HTTP request