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

Function newExpressionMatcher

modules/caddyhttp/reverseproxy/retries_test.go:263–272  ·  view source on GitHub ↗

newExpressionMatcher provisions a MatchExpression for use in tests

(t *testing.T, expr string)

Source from the content-addressed store, hash-verified

261
262// newExpressionMatcher provisions a MatchExpression for use in tests
263func newExpressionMatcher(t *testing.T, expr string) *caddyhttp.MatchExpression {
264 t.Helper()
265 ctx, cancel := caddy.NewContext(caddy.Context{Context: context.Background()})
266 t.Cleanup(cancel)
267 m := &caddyhttp.MatchExpression{Expr: expr}
268 if err := m.Provision(ctx); err != nil {
269 t.Fatalf("failed to provision expression %q: %v", expr, err)
270 }
271 return m
272}
273
274// minimalHandlerWithRetryMatch is like minimalHandler but also configures
275// RetryMatch so that response-based retry can be tested

Calls 2

ProvisionMethod · 0.95
CleanupMethod · 0.65

Tested by

no test coverage detected