Documentation ¶
Index ¶
- Constants
- type Config
- type HttpClient
- func (c *HttpClient) Delete(ctx context.Context, url, contentType string, headers xhttp.Header, ...) (err error)
- func (c *HttpClient) Do(ctx context.Context, req *xhttp.Request, res interface{}) (err error)
- func (c *HttpClient) Get(ctx context.Context, url string, headers xhttp.Header, res interface{}) (err error)
- func (c *HttpClient) PATCH(ctx context.Context, url, contentType string, headers xhttp.Header, ...) (err error)
- func (c *HttpClient) Post(ctx context.Context, url, contentType string, headers xhttp.Header, ...) (err error)
- func (c *HttpClient) Put(ctx context.Context, url, contentType string, headers xhttp.Header, ...) (err error)
- func (c *HttpClient) SetRetrier(retrier retry.Retriable)
- func (c *HttpClient) SetRetryCount(count int)
Constants ¶
View Source
const ( MIMEJSON = "application/json" MIMEHTML = "text/html" MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data" MIMEPROTOBUF = "application/x-protobuf" MIMEMSGPACK = "application/x-msgpack" MIMEMSGPACK2 = "application/msgpack" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(c *Config) *HttpClient
NewHTTPClient returns a new instance of httpClient
func (*HttpClient) Delete ¶
func (c *HttpClient) Delete(ctx context.Context, url, contentType string, headers xhttp.Header, param, res interface{}) (err error)
Delete makes a HTTP DELETE request to provided URL with context passed in
func (*HttpClient) Do ¶
Do makes an HTTP request with the native `http.Do` interface and context passed in
func (*HttpClient) Get ¶
func (c *HttpClient) Get(ctx context.Context, url string, headers xhttp.Header, res interface{}) (err error)
Get makes a HTTP GET request to provided URL with context passed in
func (*HttpClient) PATCH ¶ added in v1.0.5
func (c *HttpClient) PATCH(ctx context.Context, url, contentType string, headers xhttp.Header, param, res interface{}) (err error)
Patch makes a HTTP PATCH request to provided URL with context passed in
func (*HttpClient) Post ¶
func (c *HttpClient) Post(ctx context.Context, url, contentType string, headers xhttp.Header, param, res interface{}) (err error)
Post makes a HTTP POST request to provided URL with context passed in
func (*HttpClient) Put ¶
func (c *HttpClient) Put(ctx context.Context, url, contentType string, headers xhttp.Header, param, res interface{}) (err error)
Put makes a HTTP PUT request to provided URL with context passed in
func (*HttpClient) SetRetrier ¶
func (c *HttpClient) SetRetrier(retrier retry.Retriable)
SetRetryCount sets the retry count for the httpClient
func (*HttpClient) SetRetryCount ¶
func (c *HttpClient) SetRetryCount(count int)
SetRetryCount sets the retry count for the httpClient
Click to show internal directories.
Click to hide internal directories.