Documentation
¶
Overview ¶
Package httpclient provides a shared, rate-limited, concurrent HTTP client used across all SwaggerVu modules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a thin wrapper around http.Client adding a global rate limiter.
func (*Client) DoWithHeaders ¶
func (c *Client) DoWithHeaders(ctx context.Context, method, url string, body io.Reader, headers map[string]string) (*Response, error)
DoWithHeaders performs a request, applying per-request headers on top of the client defaults (used to send the generated Content-Type and header params).
type Options ¶
type Options struct {
Timeout time.Duration
Insecure bool
Proxy string // http(s):// proxy URL
UserAgent string
RandomizeUA bool
RatePerSecond float64 // 0 = unlimited
Headers map[string]string
FollowRedirect bool
}
Options configures a Client.
type Response ¶
Response is a lightweight captured response.
func (*Response) BodyString ¶
BodyString returns the response body as a string.
Click to show internal directories.
Click to hide internal directories.