MatchWithError returns true if r matches m.
(r *http.Request)
| 211 | |
| 212 | // MatchWithError returns true if r matches m. |
| 213 | func (m MatchExpression) MatchWithError(r *http.Request) (bool, error) { |
| 214 | celReq := celHTTPRequest{r} |
| 215 | out, _, err := m.prg.Eval(celReq) |
| 216 | if err != nil { |
| 217 | m.log.Error("evaluating expression", zap.Error(err)) |
| 218 | return false, err |
| 219 | } |
| 220 | if outBool, ok := out.Value().(bool); ok { |
| 221 | return outBool, nil |
| 222 | } |
| 223 | return false, nil |
| 224 | } |
| 225 | |
| 226 | // UnmarshalCaddyfile implements caddyfile.Unmarshaler. |
| 227 | func (m *MatchExpression) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { |