Documentation
¶
Index ¶
- func Error(span trace.Span, err error) bool
- type AuthConfig
- type Client
- func (c *Client) Auth(username, password string) *Client
- func (c *Client) BaseURL(url string) *Client
- func (c *Client) CacheDNS(val bool) *Client
- func (c *Client) ConnectTo(host string) *Client
- func (c *Client) DisableKeepAlive(val bool) *Client
- func (c *Client) Header(key, val string) *Client
- func (c *Client) InsecureSkipVerify(val bool) *Client
- func (c *Client) NTLM(val bool) *Client
- func (c *Client) NTLMV2(val bool) *Client
- func (c *Client) Proxy(url string) *Client
- func (c *Client) R(ctx context.Context) *Request
- func (c *Client) Retry(maxRetries uint, baseDuration time.Duration, exponent float64) *Client
- func (c *Client) Timeout(d time.Duration) *Client
- func (c *Client) Use(middlewares ...Middleware) *Client
- type Middleware
- type Request
- func (r *Request) Body(v any) error
- func (r *Request) Delete(url string) (*Response, error)
- func (r *Request) Do(method, reqURL string) (resp *Response, err error)
- func (r *Request) Get(url string) (*Response, error)
- func (r *Request) Header(key, value string) *Request
- func (r *Request) Patch(url string, body any) (*Response, error)
- func (r *Request) Post(url string, body any) (*Response, error)
- func (r *Request) Put(url string, body any) (*Response, error)
- func (r *Request) QueryParam(key, value string) *Request
- func (r *Request) Retry(maxRetries uint, baseDuration time.Duration, exponent float64) *Request
- type Response
- type RetryConfig
- type RoundTripperFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthConfig ¶ added in v1.13.0
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a type that represents an HTTP client
func NewClient ¶
func NewClient() *Client
NewClient configures a new HTTP client using given configuration
func (*Client) ConnectTo ¶ added in v1.13.0
ConnectTo specifies the host:port on which the URL is sought. If empty, the URL's host is used.
func (*Client) DisableKeepAlive ¶ added in v1.13.0
DisableKeepAlives prevents reuse of TCP connections
func (*Client) InsecureSkipVerify ¶ added in v1.13.0
InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name
func (*Client) Retry ¶ added in v1.13.0
Retry configuration retrying on failure with exponential backoff.
Base duration of a second & an exponent of 2 is a good option.
func (*Client) Timeout ¶ added in v1.13.0
Timeout specifies a time limit for requests made by this Client.
Default: 2 minutes
func (*Client) Use ¶ added in v1.13.0
func (c *Client) Use(middlewares ...Middleware) *Client
Use adds middleware to the client that wraps the client's transport
type Middleware ¶ added in v1.13.0
type Middleware func(http.RoundTripper) http.RoundTripper
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) Do ¶ added in v1.13.0
Do performs an HTTP request with the specified method and URL.
func (*Request) QueryParam ¶ added in v1.13.0
QueryParam sets query params
type Response ¶
type Response struct { // The underlying http.Response is embed into Response. *http.Response // Request is the Response's related Request. Request *Request }
Response extends the stdlib http.Response type and extends its functionality