Lines Matching refs:Client
5 // HTTP client. See RFC 2616.
7 // This is the high-level Client interface.
27 // A Client is an HTTP client. Its zero value (DefaultClient) is a
28 // usable client that uses DefaultTransport.
30 // The Client's Transport typically has internal state (cached TCP
34 // A Client is higher-level than a RoundTripper (such as Transport)
38 // When following redirects, the Client will forward all headers set on the
56 type Client struct {
63 // If CheckRedirect is not nil, the client calls it before
66 // first. If CheckRedirect returns an error, the Client's Get
74 // If CheckRedirect is nil, the Client uses its default policy,
83 // redirect that the Client follows.
90 // Client. The timeout includes connection time, any
97 // The Client cancels requests to the underlying Transport
99 // to Client.Do may still set Request.Cancel; both will
102 // For compatibility, the Client will also use the deprecated
109 // DefaultClient is the default Client and is used by Get, Head, and Post.
110 var DefaultClient = &Client{}
170 func (c *Client) send(req *Request, deadline time.Time) (resp *Response, didTimeout func() bool, err error) {
188 func (c *Client) deadline() time.Time {
195 func (c *Client) transport() RoundTripper {
209 return nil, alwaysFalse, errors.New("http: no Client.Transport or DefaultTransport")
219 return nil, alwaysFalse, errors.New("http: Request.RequestURI can't be set in client requests.")
263 err = errors.New("http: server gave HTTP response to HTTPS client")
339 // "To receive authorization, the client sends the userid and password,
375 // Client's CheckRedirect function:
383 // An error is returned if the Client's CheckRedirect function fails
390 // To make a request with custom headers, use NewRequest and Client.Do.
391 func (c *Client) Get(url string) (resp *Response, err error) {
401 // ErrUseLastResponse can be returned by Client.CheckRedirect hooks to
409 func (c *Client) checkRedirect(req *Request, via []*Request) error {
418 // client encounters a 3xx status code from the server
462 // client.
464 // An error is returned if caused by client policy (such as
471 // closed, the Client's underlying RoundTripper (typically Transport)
484 // If the server replies with a redirect, the Client first uses the
493 func (c *Client) Do(req *Request) (*Response, error) {
620 err: err.Error() + " (Client.Timeout exceeded while awaiting headers)",
640 func (c *Client) makeHeadersCopier(ireq *Request) func(*Request) {
719 // See the Client.Do method documentation for details on how redirects
732 // To set custom headers, use NewRequest and Client.Do.
734 // See the Client.Do method documentation for details on how redirects
736 func (c *Client) Post(url string, contentType string, body io.Reader) (resp *Response, err error) {
756 // See the Client.Do method documentation for details on how redirects
766 // To set other headers, use NewRequest and Client.Do.
771 // See the Client.Do method documentation for details on how redirects
773 func (c *Client) PostForm(url string, data url.Values) (resp *Response, err error) {
794 // Client's CheckRedirect function:
801 func (c *Client) Head(url string) (resp *Response, err error) {
830 err: err.Error() + " (Client.Timeout exceeded while reading body)",
852 // client request. Cookies automatically added via the