Documentation ¶
Index ¶
- Variables
- type HttpClient
- func (c *HttpClient) CloseIdleConnections()
- func (c *HttpClient) Do(req *http.Request) (*http.Response, error)
- func (c *HttpClient) Get(url string) (resp *http.Response, err error)
- func (c *HttpClient) Head(url string) (resp *http.Response, err error)
- func (c *HttpClient) Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
- func (c *HttpClient) PostForm(url string, data url.Values) (resp *http.Response, err error)
- type HttpClientOption
- func WithCheckRedirect(f func(req *http.Request, via []*http.Request) error) HttpClientOption
- func WithCookieJar(j http.CookieJar) HttpClientOption
- func WithRequestHeadersToForward(req *http.Request, headersNames []string) HttpClientOption
- func WithTimeout(t time.Duration) HttpClientOption
- func WithTransport(t http.RoundTripper) HttpClientOption
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHeadersToForward = []string{
"authorization",
"x-request-id",
"traceparent",
}
Functions ¶
This section is empty.
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewCtxHttpClient ¶
func NewCtxHttpClient(ctx context.Context, opts ...HttpClientOption) *HttpClient
func (*HttpClient) CloseIdleConnections ¶
func (c *HttpClient) CloseIdleConnections()
type HttpClientOption ¶
type HttpClientOption func(o *options)
func WithCheckRedirect ¶
func WithCookieJar ¶
func WithCookieJar(j http.CookieJar) HttpClientOption
func WithRequestHeadersToForward ¶
func WithRequestHeadersToForward(req *http.Request, headersNames []string) HttpClientOption
func WithTimeout ¶
func WithTimeout(t time.Duration) HttpClientOption
func WithTransport ¶
func WithTransport(t http.RoundTripper) HttpClientOption
Click to show internal directories.
Click to hide internal directories.