Documentation ¶
Index ¶
- type Client
- func (c *Client) BasicAuth(username, password string) *Client
- func (c *Client) Connect() *Request
- func (c *Client) Delete() *Request
- func (c *Client) DumpRequests() *Client
- func (c *Client) Get() *Request
- func (c *Client) Head() *Request
- func (c *Client) Header(key, value string) *Client
- func (c *Client) Hook(hook Hook) *Client
- func (c *Client) Host(host string) *Client
- func (c *Client) Options() *Request
- func (c *Client) Patch() *Request
- func (c *Client) Post() *Request
- func (c *Client) Put() *Request
- func (c *Client) Timeout(timeout time.Duration) *Client
- func (c *Client) Trace() *Request
- func (c *Client) Transport(transport http.RoundTripper) *Client
- func (c *Client) UserAgent(userAgent string) *Client
- func (c *Client) WithRetriesAndTimeout(maxRetries int, timeout time.Duration) *Client
- type Error
- type FormEntry
- type Header
- type Headers
- type Hook
- type Hooks
- type Param
- type Params
- type Request
- func (request *Request) BasicAuth(username, password string) *Request
- func (r *Request) Dump() *Request
- func (request *Request) Header(key, value string) *Request
- func (request *Request) Hook(hook Hook) *Request
- func (request *Request) JSON(object interface{}) *Request
- func (request *Request) Method(method string) *Request
- func (request *Request) MultiPartForm(values []FormEntry) *Request
- func (request *Request) Param(key, value string) *Request
- func (request *Request) Path(path string) *Request
- func (request *Request) RawBody(raw []byte) *Request
- func (request *Request) SendIt() *Response
- func (request *Request) URLEncodedParam(key, value string) *Request
- func (request *Request) UserAgent(userAgent string) *Request
- func (request *Request) XML(object interface{}) *Request
- type Response
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
}
Client is a struct used for making HTTP requests to a a single host.
func NewClient ¶
func NewClient() *Client
NewClient instantiates a client for making HTTP requests to a single host.
func (*Client) DumpRequests ¶
DumpRequests prints out the entire contents of every request to stdout.
func (*Client) Hook ¶
Hook takes in a Hook interface that gets called right before an HTTP request is made.
func (*Client) Transport ¶
func (c *Client) Transport(transport http.RoundTripper) *Client
Transport sets the HTTP transport on the client. This incldues proxying, retry policy, etc.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a struct that implements the native error interface and is instantiated after making and handling an HTTP request.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is an HTTP builder struct for making an HTTP request.
func (*Request) Hook ¶
Hook takes in a Hook interface that gets called right before an HTTP request is made.
func (*Request) JSON ¶
JSON serializes the input object into the body of the request in the form of JSON.
func (*Request) MultiPartForm ¶
MultiPartForm serializes the input values into a multi-part form request.
func (*Request) SendIt ¶
SendIt commits the HTTP request builder and captures the response as a Response struct.
func (*Request) URLEncodedParam ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response contains the response after making an HTTP request and can be used for parsing / inspecting the response.
func (*Response) Error ¶
Error returns an Error struct. This Error contains an error's that might have occurred during the build process, during the lifetime of the request, or even during the parsing of the response. Non-2XX status codes are also returned as an Error.
func (*Response) JSON ¶
JSON parses the response body as JSON and deserializes it into the input object.
func (*Response) StatusCode ¶
StatusCode returns the HTTP status code of the response. If there was an error making the request and no response was read then the status code returned is -1.