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

Method MatchWithError

modules/caddyhttp/celmatcher.go:213–224  ·  view source on GitHub ↗

MatchWithError returns true if r matches m.

(r *http.Request)

Source from the content-addressed store, hash-verified

211
212// MatchWithError returns true if r matches m.
213func (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.
227func (m *MatchExpression) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {

Callers 1

MatchMethod · 0.95

Calls 2

ErrorMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected