Validate ensures that enc's configuration is valid.
()
| 140 | |
| 141 | // Validate ensures that enc's configuration is valid. |
| 142 | func (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 | |
| 158 | func isEncodeAllowed(h http.Header) bool { |
| 159 | return !strings.Contains(h.Get("Cache-Control"), "no-transform") |
nothing calls this directly
no outgoing calls
no test coverage detected