Documentation ¶
Overview ¶
Package resttest provides utilities to test REST API.
Index ¶
- type Client
- func (c *Client) Concurrently() *Client
- func (c *Client) ExpectOtherResponsesBody(body []byte) error
- func (c *Client) ExpectOtherResponsesStatus(statusCode int) error
- func (c *Client) ExpectResponseBody(body []byte) error
- func (c *Client) ExpectResponseStatus(statusCode int) error
- func (c *Client) Reset() *Client
- func (c *Client) WithBody(body []byte) *Client
- func (c *Client) WithContentType(contentType string) *Client
- func (c *Client) WithHeader(key, value string) *Client
- func (c *Client) WithMethod(method string) *Client
- func (c *Client) WithPath(path string) *Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Headers map[string]string ConcurrencyLevel int // contains filtered or unexported fields }
Client keeps state of expectations.
func (*Client) Concurrently ¶
Concurrently enables concurrent calls to idempotent endpoint.
func (*Client) ExpectOtherResponsesBody ¶
ExpectOtherResponsesBody sets expectation for response body to be received one or more times during concurrent calling.
For example, it may describe "Not Found" response on multiple DELETE or "Conflict" response on multiple POST. Does not affect single (non-concurrent) calls.
func (*Client) ExpectOtherResponsesStatus ¶
ExpectOtherResponsesStatus sets expectation for response status to be received one or more times during concurrent calling.
For example, it may describe "Not Found" response on multiple DELETE or "Conflict" response on multiple POST. Does not affect single (non-concurrent) calls.
func (*Client) ExpectResponseBody ¶
ExpectResponseBody sets expectation for response body to be received.
In concurrent mode such response mush be met only once or for all calls.
func (*Client) ExpectResponseStatus ¶
ExpectResponseStatus sets expected response status code.
func (*Client) WithContentType ¶
WithContentType sets request content type.
func (*Client) WithHeader ¶
WithHeader sets request header.
func (*Client) WithMethod ¶
WithMethod sets request HTTP method.