Documentation ¶
Index ¶
- Variables
- type Client
- type Request
- func (r *Request) AddHeader(key, value string) *Request
- func (r *Request) Do() (*Response, error)
- func (r *Request) SetFormBody(body url.Values) *Request
- func (r *Request) SetHeader(key, value string) *Request
- func (r *Request) SetHost(value string) *Request
- func (r *Request) SetJSONBody(body interface{}) *Request
- func (r *Request) SetMethod(method string) *Request
- func (r *Request) SetURL(url string) *Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var (
NoCookieJarErr = errors.New("no cookie jar in client")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { LatestResponse *Response // contains filtered or unexported fields }
func NewClient ¶
NewClient creates a new http client Takes in the optional arguments: proxy, servername
func (*Client) NewRequest ¶
NewRequest creates a new request under a specified http client
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) AddHeader ¶
AddHeader adds a specified header to the request If the header already exists, the value will be appended by the new specified value If the header does not exist, the header will be set to the specified value
func (*Request) SetFormBody ¶
SetFormBody sets the body to a form value
func (*Request) SetHeader ¶
SetHeader sets a specified header to the request This overrides any previously set values of the specified header
func (*Request) SetJSONBody ¶
SetJSONBody sets the body to a json value
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) BodyAsJSON ¶
BodyAsJSON unmarshalls the current response body to the specified data structure
func (*Response) BodyAsString ¶
BodyAsString returns the response body as a string
func (*Response) StatusCode ¶
StatusCode returns the response status code