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

Struct ResponseMatcher

modules/caddyhttp/responsematchers.go:27–37  ·  view source on GitHub ↗

ResponseMatcher is a type which can determine if an HTTP response matches some criteria.

Source from the content-addressed store, hash-verified

25// ResponseMatcher is a type which can determine if an
26// HTTP response matches some criteria.
27type ResponseMatcher struct {
28 // If set, one of these status codes would be required.
29 // A one-digit status can be used to represent all codes
30 // in that class (e.g. 3 for all 3xx codes).
31 StatusCode []int `json:"status_code,omitempty"`
32
33 // If set, each header specified must be one of the
34 // specified values, with the same logic used by the
35 // [request header matcher](/docs/json/apps/http/servers/routes/match/header/).
36 Headers http.Header `json:"headers,omitempty"`
37}
38
39// Match returns true if the given statusCode and hdr match rm.
40func (rm ResponseMatcher) Match(statusCode int, hdr http.Header) bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected