MCPcopy Create free account
hub / github.com/caddyserver/caddy / Validate

Method Validate

modules/caddyhttp/encode/encode.go:142–156  ·  view source on GitHub ↗

Validate ensures that enc's configuration is valid.

()

Source from the content-addressed store, hash-verified

140
141// Validate ensures that enc's configuration is valid.
142func (enc *Encode) Validate() error {
143 check := make(map[string]bool)
144 for _, encName := range enc.Prefer {
145 if _, ok := enc.writerPools[encName]; !ok {
146 return fmt.Errorf("encoding %s not enabled", encName)
147 }
148
149 if _, ok := check[encName]; ok {
150 return fmt.Errorf("encoding %s is duplicated in prefer", encName)
151 }
152 check[encName] = true
153 }
154
155 return nil
156}
157
158func isEncodeAllowed(h http.Header) bool {
159 return !strings.Contains(h.Get("Cache-Control"), "no-transform")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected