Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapturedRequest ¶
CapturedRequest holds information about a received request
type HandlerConfig ¶
type HandlerConfig struct {
StatusCode int
Headers map[string]string
Body string
Delay time.Duration
}
HandlerConfig allows configuring the server's response
type TestServer ¶
type TestServer struct {
Server *http.Server
Listener net.Listener
URL string
Requests []*CapturedRequest
// contains filtered or unexported fields
}
TestServer represents a configurable HTTP/HTTPS test server
func NewTLS ¶
func NewTLS() (*TestServer, error)
NewTLS creates a new HTTPS test server with self-signed certificate
func NewTLSWithConfig ¶
func NewTLSWithConfig(config *HandlerConfig) (*TestServer, error)
NewTLSWithConfig creates a new HTTPS test server with custom response config
func NewWithConfig ¶
func NewWithConfig(config *HandlerConfig) (*TestServer, error)
NewWithConfig creates a new HTTP test server with custom response config
func (*TestServer) ClearRequests ¶
func (ts *TestServer) ClearRequests()
ClearRequests clears all captured requests (thread-safe)
func (*TestServer) GetRequests ¶
func (ts *TestServer) GetRequests() []*CapturedRequest
GetRequests returns all captured requests (thread-safe)
Click to show internal directories.
Click to hide internal directories.