Help us shape the future of Go! Take the 2026 Go Developer Survey

test

package
v0.52.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 WithResponseChecker(responseChecker func(*testing.T, *http.Response) bool) HTTPResponseExpectOpt

func WithStatusCode

func WithStatusCode(expected int) HTTPResponseExpectOpt

func WithWaitFor

func WithWaitFor(waitFor time.Duration) HTTPResponseExpectOpt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL