Documentation ¶
Index ¶
- type BeforeRetryFn
- type HttpClient
- func (c *HttpClient) Do(ctx context.Context, method string) ([]byte, error)
- func (c *HttpClient) DoFormEncoding(ctx context.Context, method string) ([]byte, error)
- func (c *HttpClient) DoFormMultipart(ctx context.Context) ([]byte, error)
- func (c *HttpClient) URL() string
- func (c *HttpClient) WithBasicAuth(username string, password string) *HttpClient
- func (c *HttpClient) WithBearerAuth(token string) *HttpClient
- func (c *HttpClient) WithHeaders(headers map[string]string) *HttpClient
- func (c *HttpClient) WithPayload(params interface{}) *HttpClient
- func (c *HttpClient) WithUrl(uri string, params map[string]string) *HttpClient
- type HttpClientV2
- func (c *HttpClientV2) Do(ctx context.Context, method string) ([]byte, error)
- func (c *HttpClientV2) DoFormEncoding(ctx context.Context, method string) ([]byte, error)
- func (c *HttpClientV2) WithBasicAuth(username string, password string) *HttpClientV2
- func (c *HttpClientV2) WithBearerAuth(token string) *HttpClientV2
- func (c *HttpClientV2) WithHeaders(headers map[string]string) *HttpClientV2
- func (c *HttpClientV2) WithPayload(params interface{}) *HttpClientV2
- func (c *HttpClientV2) WithRetryFn(statusCode int, fn BeforeRetryFn) *HttpClientV2
- func (c *HttpClientV2) WithUrl(uri string, params map[string]string) *HttpClientV2
- type HttpExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeforeRetryFn ¶ added in v1.0.9
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(httpExecutor HttpExecutor, timeout time.Duration) *HttpClient
func NewRetryHttpClient ¶
func NewRetryHttpClient(httpExecutor HttpExecutor, timeout time.Duration, retry uint64) *HttpClient
func (*HttpClient) DoFormEncoding ¶
func (*HttpClient) DoFormMultipart ¶
func (c *HttpClient) DoFormMultipart(ctx context.Context) ([]byte, error)
func (*HttpClient) URL ¶
func (c *HttpClient) URL() string
func (*HttpClient) WithBasicAuth ¶
func (c *HttpClient) WithBasicAuth(username string, password string) *HttpClient
func (*HttpClient) WithBearerAuth ¶
func (c *HttpClient) WithBearerAuth(token string) *HttpClient
func (*HttpClient) WithHeaders ¶
func (c *HttpClient) WithHeaders(headers map[string]string) *HttpClient
func (*HttpClient) WithPayload ¶
func (c *HttpClient) WithPayload(params interface{}) *HttpClient
func (*HttpClient) WithUrl ¶
func (c *HttpClient) WithUrl(uri string, params map[string]string) *HttpClient
type HttpClientV2 ¶ added in v1.0.9
type HttpClientV2 struct { HttpClient // contains filtered or unexported fields }
func NewHttpClientV2 ¶ added in v1.0.9
func NewHttpClientV2(httpExecutor HttpExecutor, timeout time.Duration) *HttpClientV2
func NewRetryHttpClientV2 ¶ added in v1.0.9
func NewRetryHttpClientV2(httpExecutor HttpExecutor, timeout time.Duration, retry uint64) *HttpClientV2
func (*HttpClientV2) DoFormEncoding ¶ added in v1.0.9
func (*HttpClientV2) WithBasicAuth ¶ added in v1.1.0
func (c *HttpClientV2) WithBasicAuth(username string, password string) *HttpClientV2
func (*HttpClientV2) WithBearerAuth ¶ added in v1.1.0
func (c *HttpClientV2) WithBearerAuth(token string) *HttpClientV2
func (*HttpClientV2) WithHeaders ¶ added in v1.1.0
func (c *HttpClientV2) WithHeaders(headers map[string]string) *HttpClientV2
func (*HttpClientV2) WithPayload ¶ added in v1.1.0
func (c *HttpClientV2) WithPayload(params interface{}) *HttpClientV2
func (*HttpClientV2) WithRetryFn ¶ added in v1.0.9
func (c *HttpClientV2) WithRetryFn(statusCode int, fn BeforeRetryFn) *HttpClientV2
func (*HttpClientV2) WithUrl ¶ added in v1.1.0
func (c *HttpClientV2) WithUrl(uri string, params map[string]string) *HttpClientV2
type HttpExecutor ¶
type HttpExecutor interface { Execute(r *http.Request, timeout time.Duration, retry uint64) (int, []byte, error) WithPrometheusHttpConfig(conf *u_prometheus.HttpConfig) HttpExecutor }
func NewHttpExecutor ¶
func NewHttpExecutor() HttpExecutor
Click to show internal directories.
Click to hide internal directories.