Documentation
¶
Index ¶
- type Client
- func (http *Client) Body(raw []byte) *Client
- func (http *Client) BodyJSON(obj interface{}) *Client
- func (http *Client) BodyString(raw string) *Client
- func (http *Client) Do() error
- func (http *Client) End() (*Response, error)
- func (http *Client) EndStruct(obj interface{}) (*Response, error)
- func (http *Client) Header(key string, value string) *Client
- func (http *Client) Headers(headers Headers) *Client
- func (http *Client) Response() *Response
- type Headers
- type Response
- func (response Response) Bytes() []byte
- func (response Response) Header(name []byte) []byte
- func (response Response) HeaderString(name string) string
- func (response Response) Ok() bool
- func (response Response) RawBytes() []byte
- func (response Response) RawHeaders() []byte
- func (response Response) RawHeadersString() string
- func (response Response) RawString() string
- func (response Response) StatusCode() int
- func (response Response) String() string
- func (response Response) Unmarshal(obj interface{}) error
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 represents a single
func (*Client) BodyString ¶ added in v1.0.0
BodyString sets the request body.
func (*Client) EndStruct ¶
EndStruct executes the request, unmarshals the response body into a struct and returns the response.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response represents the HTTP response used in the given client.
func (Response) Bytes ¶
Bytes returns the response body as a byte slice and unzips gzipped content when necessary.
func (Response) HeaderString ¶ added in v1.0.0
HeaderString returns the string value for the given header.
func (Response) Ok ¶ added in v1.0.0
Ok returns true if the HTTP status code is not lower than 200 and not 400 or higher.
func (Response) RawHeaders ¶ added in v1.0.0
RawHeaders returns headers as a byte slice.
func (Response) RawHeadersString ¶ added in v1.0.0
RawHeadersString returns headers as a string.
func (Response) StatusCode ¶
StatusCode returns the status code of the response.
Click to show internal directories.
Click to hide internal directories.