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

Method Match

modules/caddyhttp/fileserver/matcher.go:317–324  ·  view source on GitHub ↗

Match returns true if r matches m. Returns true if a file was matched. If so, four placeholders will be available: - http.matchers.file.relative: Path to file relative to site root - http.matchers.file.absolute: Path to file including site root - http.matchers.file.type: file or directory - http.mat

(r *http.Request)

Source from the content-addressed store, hash-verified

315// - http.matchers.file.type: file or directory
316// - http.matchers.file.remainder: Portion remaining after splitting file path (if configured)
317func (m MatchFile) Match(r *http.Request) bool {
318 match, err := m.selectFile(r)
319 if err != nil {
320 // nolint:staticcheck
321 caddyhttp.SetVar(r.Context(), caddyhttp.MatcherErrorVarKey, err)
322 }
323 return match
324}
325
326// MatchWithError returns true if r matches m.
327func (m MatchFile) MatchWithError(r *http.Request) (bool, error) {

Callers

nothing calls this directly

Calls 2

selectFileMethod · 0.95
SetVarFunction · 0.92

Tested by

no test coverage detected