Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultRetryCount represents how many time to retry a HTTP request by default. // We will start with no retry. DefaultRetryCount = 0 // DefaultHTTPTimeout is the timeout for HTTP requests. DefaultHTTPTimeout = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(config *ClientConfig) *httpClient
NewClient creates a new HTTP client.
Types ¶
type Client ¶
type Client interface { Request(method string, url string, params, result interface{}) (res *http.Response, err error) RequestAddHeaders(method string, url string, headers *map[string]string, params, result interface{}) (res *http.Response, err error) }
Make http easy to mock for unit testing
type ClientConfig ¶
ClientConfig contains configurations to construct a client.
Click to show internal directories.
Click to hide internal directories.