Documentation
¶
Overview ¶
Package httpserver provides a configurable mock HTTP server for testing and development purposes. It allows users to define request matching rules and dynamic templated responses via configuration files. Features include support for request sequencing, custom headers, authentication, TLS, and advanced response templating.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
*output.Options
TLSCertificate string // TLS certificate file path.
TLSKey string // TLS key file path.
ReadTimeout time.Duration // HTTP Server read timeout.
WriteTimeout time.Duration // HTTP Server write timeout.
ConfigPath string // Config path.
DelayParticipation float32 // Delay participation rate (fraction of requests that will be delayed. 0.0 <= p <= 1.0).
DelayDuration time.Duration // Delay duration.
FaultParticipation float32 // Fault participation rate (fraction of requests that will fail. 0.0 <= p <= 1.0).
FaultErrorCode int // Fault HTTP error code.
ExitOnUnmatchedRule bool // If true it will exit if a request does not match any rule.
}
Options are the options for the HTTP server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an HTTP server for mocking HTTP responses.
func New ¶
func New(opts *Options, logger *zap.SugaredLogger) (*Server, error)
New creates a new HTTP server.
Click to show internal directories.
Click to hide internal directories.