Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientBuilder ¶
type ClientBuilder interface {
SetCommonHeaders(headers http.Header) ClientBuilder
SetConnectionTimeout(timeout time.Duration) ClientBuilder
SetResponseTimeout(timeout time.Duration) ClientBuilder
SetMaxIdleConnections(connections int) ClientBuilder
SetHttpClient(client *http.Client) ClientBuilder
SetUserAgent(agent string) ClientBuilder
DisableAllTimeouts(disable bool) ClientBuilder
Build() HttpClient
BuildMockClient() (HttpClient, MockKeeper)
}
ClientBuilder provides a clean way to configure HTTP Client based on the combination of methods
func NewBuilder ¶
func NewBuilder() ClientBuilder
type HttpClient ¶
type HttpClient interface {
Get(url string, headers ...http.Header) (*Response, error)
Post(url string, body interface{}, headers ...http.Header) (*Response, error)
Put(url string, body interface{}, headers ...http.Header) (*Response, error)
Patch(url string, body interface{}, headers ...http.Header) (*Response, error)
Delete(url string, headers ...http.Header) (*Response, error)
Options(url string, headers ...http.Header) (*Response, error)
}
HttpClient provides a clean way to perform an HTTP call
type Mock ¶
type Mock struct {
Method string
Url string
RequestBody string
Error error
ResponseStatusCode int
ResponseBody string
ResponseHeaders http.Header
}
Mock structure provides a clean way to configure HTTP mocks based on the combination between HTTP method, URL and HTTP body (md5 hash).
type MockKeeper ¶
type MockKeeper struct {
// contains filtered or unexported fields
}
func (*MockKeeper) AddMock ¶
func (m *MockKeeper) AddMock(mock Mock)
func (*MockKeeper) DeleteMocks ¶
func (m *MockKeeper) DeleteMocks()
Click to show internal directories.
Click to hide internal directories.