Documentation
¶
Index ¶
- type Client
- type ClientContext
- type MockClient
- func (_m *MockClient) Do(req *http.Request) (*http.Response, error)
- func (_m *MockClient) EXPECT() *MockClientMockRecorder
- func (_m *MockClient) Get(url string) (*http.Response, error)
- func (_m *MockClient) Head(url string) (*http.Response, error)
- func (_m *MockClient) Post(url string, contentType string, body io.Reader) (*http.Response, error)
- func (_m *MockClient) PostForm(url string, data url.Values) (*http.Response, error)
- type MockClientMockRecorder
- func (_mr *MockClientMockRecorder) Do(arg0 interface{}) *gomock.Call
- func (_mr *MockClientMockRecorder) Get(arg0 interface{}) *gomock.Call
- func (_mr *MockClientMockRecorder) Head(arg0 interface{}) *gomock.Call
- func (_mr *MockClientMockRecorder) Post(arg0, arg1, arg2 interface{}) *gomock.Call
- func (_mr *MockClientMockRecorder) PostForm(arg0, arg1 interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Do(req *http.Request) (*http.Response, error)
Get(url string) (resp *http.Response, err error)
Head(url string) (resp *http.Response, err error)
Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)
PostForm(url string, data url.Values) (resp *http.Response, err error)
}
Client provides an interface for the `http.Client` concrete type
type ClientContext ¶
type ClientContext interface {
Client
// GetContext is the same as Get but accepts a context
GetContext(ctx context.Context, url string) (resp *http.Response, err error)
// HeadContext is the same as Head but accepts a context
HeadContext(ctx context.Context, url string) (resp *http.Response, err error)
// PostContext is the same as Post but accepts a context
PostContext(ctx context.Context, url string, contentType string, body io.Reader) (resp *http.Response, err error)
// PostFormContext is the same as PostForm but accepts a context
PostFormContext(ctx context.Context, url string, data url.Values) (resp *http.Response, err error)
}
ClientContext provides context aware methods for HTTP requests
func NewContext ¶
func NewContext(client Client) ClientContext
NewContext wraps a Client with context aware methods
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance
func (*MockClient) EXPECT ¶
func (_m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockClient) Get ¶
func (_m *MockClient) Get(url string) (*http.Response, error)
Get mocks base method
func (*MockClient) Head ¶
func (_m *MockClient) Head(url string) (*http.Response, error)
Head mocks base method
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient
func (*MockClientMockRecorder) Do ¶
func (_mr *MockClientMockRecorder) Do(arg0 interface{}) *gomock.Call
Do indicates an expected call of Do
func (*MockClientMockRecorder) Get ¶
func (_mr *MockClientMockRecorder) Get(arg0 interface{}) *gomock.Call
Get indicates an expected call of Get
func (*MockClientMockRecorder) Head ¶
func (_mr *MockClientMockRecorder) Head(arg0 interface{}) *gomock.Call
Head indicates an expected call of Head
func (*MockClientMockRecorder) Post ¶
func (_mr *MockClientMockRecorder) Post(arg0, arg1, arg2 interface{}) *gomock.Call
Post indicates an expected call of Post
func (*MockClientMockRecorder) PostForm ¶
func (_mr *MockClientMockRecorder) PostForm(arg0, arg1 interface{}) *gomock.Call
PostForm indicates an expected call of PostForm