Documentation ¶
Index ¶
- type Client
- func (c *Client) CtxDo(ctx context.Context, req *http.Request) (*http.Response, error)
- func (c *Client) DisableH2() (ok bool)
- func (c *Client) UseCoreDialer(set func(*CoreDialer) http.Dialer) (ok bool)
- func (c *Client) UseDialer(wrap func(http.Dialer) http.Dialer)
- func (c *Client) UseGetProxy(getProxy func(ctx context.Context, r *http.Request) (string, error)) (ok bool)
- type CoreDialer
- type PreparedRequest
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
}
func (*Client) UseCoreDialer ¶
func (c *Client) UseCoreDialer(set func(*CoreDialer) http.Dialer) (ok bool)
UseCoreDialer is a shortcut to [UseDialer] that unwraps the current dialer until it meets a *CoreDialer returns false if no *CoreDialer is found
func (*Client) UseDialer ¶
UseDialer provides the interface to modify the dialer used for setting up the underlying connections that a request is sent to and a response is read from. Connection pooling should be implemented at this layer.
This package provides a default dialer type CoreDialer, which uses the pooling logic in the package [netpool]. Users are encouraged to re-use the package if they needed to implement their own [Dialer], however not necessary. Users could get the underlying default CoreDialer and modify the default logic by [Dialer.Unwrap]ping the given dialer.
For example, http2 can be disabled by removing the "h2" from tls ALPN. See how it is be done in Client.DisableH2.
type CoreDialer ¶
type CoreDialer = dialer.CoreDialer
type PreparedRequest ¶
type PreparedRequest = http.PreparedRequest