Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorTransport ¶
type ErrorTransport struct{}
ErrorTransport is custom transport that always produces a simulated network error.
type HTTPMethod ¶
type HTTPMethod = string
HTTPMethod is an alias for string, representing an HTTP method.
type ServerResponses ¶
type ServerResponses map[HTTPMethod]struct { ResponseCode int // HTTP response status code. ResponseBody string // HTTP response body. ValidateRequestFunc func(*http.Request) // Function to validate incoming requests. }
ServerResponses is a map of HTTP methods to expected responses for testing.
type TestServer ¶
type TestServer struct {
*httptest.Server // Embedded httptest.Server for underlying server functionality.
}
TestServer is a wrapper around httptest.Server that provides utility methods for testing.
func NewHTTPTestServer ¶
func NewHTTPTestServer(t *testing.T, arg ServerResponses) *TestServer
NewHTTPTestServer creates a new HTTP test server with the specified responses for each HTTP method.
func (TestServer) Client ¶
func (t TestServer) Client() *http.Client
Client returns an HTTP client associated with the test server.
func (TestServer) FaultyClient ¶
func (t TestServer) FaultyClient() *http.Client
FaultyClient returns an HTTP client associated with the test server that always produces a network error.
Click to show internal directories.
Click to hide internal directories.