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

Method Match

modules/caddyhttp/routes.go:350–368  ·  view source on GitHub ↗

Match returns true if the request matches all matchers in mset or if there are no matchers.

(r *http.Request)

Source from the content-addressed store, hash-verified

348// Match returns true if the request matches all
349// matchers in mset or if there are no matchers.
350func (mset MatcherSet) Match(r *http.Request) bool {
351 for _, m := range mset {
352 if me, ok := m.(RequestMatcherWithError); ok {
353 match, _ := me.MatchWithError(r)
354 if !match {
355 return false
356 }
357 continue
358 }
359 if me, ok := m.(RequestMatcher); ok {
360 if !me.Match(r) {
361 return false
362 }
363 continue
364 }
365 return false
366 }
367 return true
368}
369
370// MatchWithError returns true if r matches m.
371func (mset MatcherSet) MatchWithError(r *http.Request) (bool, error) {

Callers

nothing calls this directly

Calls 2

MatchWithErrorMethod · 0.65
MatchMethod · 0.65

Tested by

no test coverage detected