Documentation ¶
Index ¶
- type Client
- func (c *Client) BaseClient() *http.Client
- func (c *Client) BaseURL() *url.URL
- func (c *Client) Delete(path string, opts ...Option) (*http.Response, error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Get(path string, opts ...Option) (*http.Response, error)
- func (c *Client) Header() http.Header
- func (c *Client) NewRequest(method, path string, body io.Reader, opts ...Option) (*http.Request, error)
- func (c *Client) Post(path string, contentType string, body io.Reader, opts ...Option) (*http.Response, error)
- func (c *Client) Put(path string, contentType string, body io.Reader, opts ...Option) (*http.Response, error)
- type HTTPError
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is an HTTP client.
func (*Client) BaseClient ¶
BaseClient returns the base client.
func (*Client) Do ¶
Do sends an HTTP request and returns an HTTP response, following policy (such as redirects, cookies, auth) as configured on the client.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, path string, body io.Reader, opts ...Option) (*http.Request, error)
NewRequest returns a new Request given a method, path, and optional body. Also adds the authorization header with the ACS token to work with the DC/OS cluster we are linked to if it has been set.
type HTTPError ¶
HTTPError represents an HTTP error, it is returned when FailOnErrStatus is enabled.
type Option ¶
type Option func(opts *Options)
Option is a functional option for an HTTP client.
func FailOnErrStatus ¶
FailOnErrStatus specifies whether or not the client should fail on HTTP error response (4XX / 5XX).