Documentation ¶
Index ¶
- func EventuallyExpectResponse(t *testing.T, httpClient *http.Client, req *http.Request, ...)
- type HTTPResponseExpectOpt
- func WithBodyContains(s string) HTTPResponseExpectOpt
- func WithEnterpriseHeader() HTTPResponseExpectOpt
- func WithInterval(interval time.Duration) HTTPResponseExpectOpt
- func WithResponseChecker(responseChecker func(*testing.T, *http.Response) bool) HTTPResponseExpectOpt
- func WithStatusCode(expected int) HTTPResponseExpectOpt
- func WithWaitFor(waitFor time.Duration) HTTPResponseExpectOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventuallyExpectResponse ¶
func EventuallyExpectResponse( t *testing.T, httpClient *http.Client, req *http.Request, opts ...HTTPResponseExpectOpt, )
EventuallyExpectedResponse is a helper function that issues the provided request until it gets the expected response or the timeout (default: 1 minute) is reached. For assertions about the received response one can provide options like WithStatusCode or WithBodyContains. NOTE: only one option checking the body can be provided since body's reader can only be read once. Default is to retry for 1 minute with 1 second interval.
Types ¶
type HTTPResponseExpectOpt ¶
type HTTPResponseExpectOpt func(*httpResponseExpectOpts)
func WithBodyContains ¶
func WithBodyContains(s string) HTTPResponseExpectOpt
func WithEnterpriseHeader ¶
func WithEnterpriseHeader() HTTPResponseExpectOpt
func WithInterval ¶
func WithInterval(interval time.Duration) HTTPResponseExpectOpt
func WithResponseChecker ¶
func WithStatusCode ¶
func WithStatusCode(expected int) HTTPResponseExpectOpt
func WithWaitFor ¶
func WithWaitFor(waitFor time.Duration) HTTPResponseExpectOpt
Click to show internal directories.
Click to hide internal directories.