MCPcopy
hub / github.com/caddyserver/caddy / Handler

Struct Handler

modules/caddyhttp/map/map.go:39–54  ·  view source on GitHub ↗

Handler implements a middleware that maps inputs to outputs. Specifically, it compares a source value against the map inputs, and for one that matches, it applies the output values to each destination. Destinations become placeholder names. Mapped placeholders are not evaluated until they are used,

Source from the content-addressed store, hash-verified

37// Mapped placeholders are not evaluated until they are used, so even for very
38// large mappings, this handler is quite efficient.
39type Handler struct {
40 // Source is the placeholder from which to get the input value.
41 Source string `json:"source,omitempty"`
42
43 // Destinations are the names of placeholders in which to store the outputs.
44 // Destination values should be wrapped in braces, for example, {my_placeholder}.
45 Destinations []string `json:"destinations,omitempty"`
46
47 // Mappings from source values (inputs) to destination values (outputs).
48 // The first matching, non-nil mapping will be applied.
49 Mappings []Mapping `json:"mappings,omitempty"`
50
51 // If no mappings match or if the mapped output is null/nil, the associated
52 // default output will be applied (optional).
53 Defaults []string `json:"defaults,omitempty"`
54}
55
56// CaddyModule returns the Caddy module information.
57func (Handler) CaddyModule() caddy.ModuleInfo {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected