Documentation ¶
Overview ¶
Package rest is used internally by the client to interact with the mountebank API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a generic HTTP REST client that handles a JSON structure in requests and responses.
func NewClient ¶
NewClient returns a new instance of *Client from the provided inner *http.Client httpClient and API base *url.URL baseURL.
func (*Client) DecodeResponseBody ¶
func (cli *Client) DecodeResponseBody(body io.ReadCloser, v interface{}) error
DecodeResponseBody reads a JSON-encoded value from the provided HTTP response body and stores it into the value pointed to by v and closes the body after reading.
func (*Client) NewRequest ¶
func (cli *Client) NewRequest(ctx context.Context, method, path string, body io.Reader, q url.Values) (*http.Request, error)
NewRequest builds the specified *http.Request value from the provided request method, path, body and optional body/query parameters, with the appropriate headers set depending on the particular request method.