Skip to content

Commit 190ad60

Browse files
committed
rewrite: provision query replace test via Provision path
1 parent 1776fab commit 190ad60

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

modules/caddyhttp/rewrite/rewrite_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -529,15 +529,9 @@ func TestQueryOpsReplaceScopedToKey(t *testing.T) {
529529
repl.Set("http.request.uri.path", tc.input.URL.Path)
530530
repl.Set("http.request.uri.query", tc.input.URL.RawQuery)
531531

532-
// we can't directly call Provision() without a valid caddy.Context
533-
// so here we ad-hoc compile the regex
534532
for _, rep := range tc.ops.Replace {
535-
if rep.SearchRegexp != "" {
536-
re, err := regexp.Compile(rep.SearchRegexp)
537-
if err != nil {
538-
t.Fatal(err)
539-
}
540-
rep.re = re
533+
if err := rep.Provision(caddy.Context{}); err != nil {
534+
t.Fatal(err)
541535
}
542536
}
543537

0 commit comments

Comments
 (0)