Documentation ¶
Index ¶
Constants ¶
View Source
const ( GET string = http.MethodGet POST string = http.MethodPost PUT string = http.MethodPut DELETE string = http.MethodDelete )
HTTP const definitions
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client -
func NewClientWithTimeout ¶
NewClientWithTimeout - creates a new HTTP client, with a timeout
type MockHTTPClient ¶
type MockHTTPClient struct { Client Response *Response // this for if you want to set your own dummy response ResponseCode int // this for if you only care about a particular response code ResponseError error RespCount int Responses []MockResponse Requests []Request // lists all requests the client has received sync.Mutex }
MockHTTPClient - use for mocking the HTTP client
func (*MockHTTPClient) Send ¶
func (c *MockHTTPClient) Send(request Request) (*Response, error)
Send -
func (*MockHTTPClient) SetResponse ¶
func (c *MockHTTPClient) SetResponse(filepath string, code int)
SetResponse - if you care about the response content and the code, pass both in if you only care about the code, pass "" for the filepath
func (*MockHTTPClient) SetResponses ¶
func (c *MockHTTPClient) SetResponses(responses []MockResponse)
SetResponses - if you care about the response content and the code, pass both in if you only care about the code, pass "" for the filepath
type MockResponse ¶
MockResponse - use for mocking the MockHTTPClient responses
Click to show internal directories.
Click to hide internal directories.