Encode is a middleware which can encode responses.
| 40 | |
| 41 | // Encode is a middleware which can encode responses. |
| 42 | type 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. |
| 61 | func (Encode) CaddyModule() caddy.ModuleInfo { |
nothing calls this directly
no outgoing calls
no test coverage detected