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

Struct Encode

modules/caddyhttp/encode/encode.go:42–58  ·  modules/caddyhttp/encode/encode.go::Encode

Encode is a middleware which can encode responses.

Source from the content-addressed store, hash-verified

40
41// Encode is a middleware which can encode responses.
42type Encode struct {
43 // Selection of compression algorithms to choose from. The best one
44 // will be chosen based on the client's Accept-Encoding header.
45 EncodingsRaw caddy.ModuleMap `json:"encodings,omitempty" caddy:"namespace=http.encoders"`
46
47 // If the client has no strong preference, choose these encodings in order.
48 Prefer []string `json:"prefer,omitempty"`
49
50 // Only encode responses that are at least this many bytes long.
51 MinLength int `json:"minimum_length,omitempty"`
52
53 // Only encode responses that match against this ResponseMatcher.
54 // The default is a collection of text-based Content-Type headers.
55 Matcher *caddyhttp.ResponseMatcher `json:"match,omitempty"`
56
57 writerPools map[string]*sync.Pool // TODO: these pools do not get reused through config reloads...
58}
59
60// CaddyModule returns the Caddy module information.
61func (Encode) CaddyModule() caddy.ModuleInfo {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected