Documentation
¶
Index ¶
- type Client
- func (c *Client) Delete(ctx context.Context, url string, parameters ...httpclient.RequestParameter) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, url string, parameters ...httpclient.RequestParameter) (*http.Response, error)
- func (c *Client) HTTPMock() *httpmock.MockTransport
- func (c *Client) Head(ctx context.Context, url string, parameters ...httpclient.RequestParameter) (*http.Response, error)
- func (c *Client) NewJSONBodyMatcher(body string) httpmock.MatcherFunc
- func (c *Client) NewMockRequest(method, url string, params ...httpclient.RequestParameter) *MockRequest
- func (c *Client) Patch(ctx context.Context, url string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) Post(ctx context.Context, url string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) WithBaseURL(baseURL string) (*Client, error)
- func (c *Client) WithDefaultHeaders(headers map[string]string) *Client
- type HttpTestRequestParameter
- type MockRequest
- func (r *MockRequest) Register()
- func (r *MockRequest) RespondWithHeaders(respHeaders map[string]string) *MockRequest
- func (r *MockRequest) RespondWithJSON(statusCode int, body string) *MockRequest
- func (r *MockRequest) Responder(resp httpmock.Responder) *MockRequest
- func (r *MockRequest) String() string
- type MockResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*httpclient.Client
// contains filtered or unexported fields
}
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, url string, parameters ...httpclient.RequestParameter) (*http.Response, error)
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, url string, parameters ...httpclient.RequestParameter) (*http.Response, error)
func (*Client) HTTPMock ¶
func (c *Client) HTTPMock() *httpmock.MockTransport
HTTPMock exposes the httpmock.MockTransport instance for advanced usage.
func (*Client) Head ¶
func (c *Client) Head(ctx context.Context, url string, parameters ...httpclient.RequestParameter) (*http.Response, error)
func (*Client) NewJSONBodyMatcher ¶
func (c *Client) NewJSONBodyMatcher(body string) httpmock.MatcherFunc
func (*Client) NewMockRequest ¶
func (c *Client) NewMockRequest(method, url string, params ...httpclient.RequestParameter) *MockRequest
func (*Client) WithBaseURL ¶
WithBaseURL sets the base URL setting for the underlying `httpclient.Client`.
type HttpTestRequestParameter ¶
type HttpTestRequestParameter httpclient.RequestParameter
type MockRequest ¶
type MockRequest struct {
// contains filtered or unexported fields
}
func (*MockRequest) Register ¶
func (r *MockRequest) Register()
func (*MockRequest) RespondWithHeaders ¶
func (r *MockRequest) RespondWithHeaders(respHeaders map[string]string) *MockRequest
RespondWithHeaders configures the response headers. It can be used multiple times in order to pass different headers. If the header key already exists it will be overwritten.
func (*MockRequest) RespondWithJSON ¶
func (r *MockRequest) RespondWithJSON(statusCode int, body string) *MockRequest
RespondWithJSON will configure a JSON response with the given status code.
func (*MockRequest) Responder ¶
func (r *MockRequest) Responder(resp httpmock.Responder) *MockRequest
Responder provides access to the current responder for inspection or direct operations.
func (*MockRequest) String ¶
func (r *MockRequest) String() string
String provides a representation of the mock request. Only used for debugging purposes.
type MockResponse ¶
Click to show internal directories.
Click to hide internal directories.