rewrite: provision query replace test via Provision path

This commit is contained in:
alhudz 2026-06-15 13:05:20 +05:30
parent 1776fab512
commit 190ad60799

View file

@ -529,15 +529,9 @@ func TestQueryOpsReplaceScopedToKey(t *testing.T) {
repl.Set("http.request.uri.path", tc.input.URL.Path)
repl.Set("http.request.uri.query", tc.input.URL.RawQuery)
// we can't directly call Provision() without a valid caddy.Context
// so here we ad-hoc compile the regex
for _, rep := range tc.ops.Replace {
if rep.SearchRegexp != "" {
re, err := regexp.Compile(rep.SearchRegexp)
if err != nil {
t.Fatal(err)
}
rep.re = re
if err := rep.Provision(caddy.Context{}); err != nil {
t.Fatal(err)
}
}