Documentation ¶
Index ¶
- type Client
- func (c *Client) Do(req *http.Request) (resp *http.Response, err error)
- func (c *Client) Get(url string) (resp *http.Response, err error)
- func (c *Client) Head(url string) (resp *http.Response, err error)
- func (c *Client) Jar(j *cookiejar.Jar) *Client
- func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error)
- func (c *Client) PostForm(url string, data url.Values) (resp *http.Response, err error)
- func (c *Client) Timeout(t time.Duration) *Client
- type Credentials
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 wrapper to http.client. It is used as builder to construct the real http client
func NewClient ¶
NewClient creates and initializes a new goha http client that will be able to authorize its requests via Basic / Digest authentication scheme.
func NewClientWithTransport ¶
func NewClientWithTransport(username, password string, transport http.RoundTripper) *Client
NewClient creates a new goha http client with provided http.Transport
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
credentials represents the necessary data that will be used to generate the digest Authorization header
func NewCredentials ¶
func NewCredentials(username, password, header, uri, method string) *Credentials
newCredentials creates and initializes a new credentials. It uses WWW-Authenticate header received from server to parse the challenge.
func (*Credentials) AuthHeader ¶
func (c *Credentials) AuthHeader() string
authHeader returns the value that will be applied to the Authorization header. With this header the http client authorizes the request.