Documentation
¶
Index ¶
- type Middleware
- func (Middleware) CaddyModule() caddy.ModuleInfo
- func (m *Middleware) Provision(ctx caddy.Context) error
- func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (m *Middleware) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
DelayDuration time.Duration `json:"delay_duration"`
PercentDelayed float64 `json:"percent_delayed"`
// contains filtered or unexported fields
}
Middleware implements an HTTP handler that delays approximately PercentDelayed requests by DelayDuration
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Middleware) ServeHTTP ¶
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler
func (*Middleware) UnmarshalCaddyfile ¶
func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler. Syntax:
random_delay <percent_delayed> <duration>
When radnom_delay is used, precent_delayed of requests will be delayed by <duration> before the request is passed to the next handler. This can be helpful in scenarios where latency or timeouts need to be simulated such as when chaos testing or reproducing a problem.
func (*Middleware) Validate ¶
func (m *Middleware) Validate() error
Validate implements caddy.Validator.
Click to show internal directories.
Click to hide internal directories.