Documentation ¶
Index ¶
- type Client
- func (c *Client) Get() (*Response, error)
- func (c *Client) PostForm(values url.Values) (*Response, error)
- func (c *Client) PostJSON(data interface{}) (*Response, error)
- func (c *Client) WithAuthorization(authorization string) *Client
- func (c *Client) WithCacheHeaders(etagHeader, lastModifiedHeader string) *Client
- func (c *Client) WithCredentials(username, password string) *Client
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Insecure bool // contains filtered or unexported fields }
Client is a HTTP Client :)
func (*Client) WithAuthorization ¶
WithAuthorization defines authorization header value.
func (*Client) WithCacheHeaders ¶
WithCacheHeaders defines caching headers.
func (*Client) WithCredentials ¶
WithCredentials defines the username/password for HTTP Basic authentication.
type Response ¶
type Response struct { Body io.Reader StatusCode int EffectiveURL string LastModified string ETag string ContentType string ContentLength int64 }
Response wraps a server response.
func (*Response) HasServerFailure ¶
HasServerFailure returns true if the status code represents a failure.
func (*Response) IsModified ¶
IsModified returns true if the resource has been modified.
func (*Response) IsNotAuthorized ¶
IsNotAuthorized returns true if the resource require authentication.
func (*Response) IsNotFound ¶
IsNotFound returns true if the resource doesn't exists anymore.
func (*Response) NormalizeBodyEncoding ¶
NormalizeBodyEncoding make sure the body is encoded in UTF-8.
If a charset other than UTF-8 is detected, we convert the document to UTF-8. This is used by the scraper and feed readers.
Do not forget edge cases: - Some non-utf8 feeds specify encoding only in Content-Type, not in XML document.