mirror of
https://github.com/caddyserver/caddy.git
synced 2026-07-01 14:21:53 +00:00
rewrite: provision query replace test via Provision path
This commit is contained in:
parent
1776fab512
commit
190ad60799
1 changed files with 2 additions and 8 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue