-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite:
uri query
replace operation (#6165)
* Implemented query replace oeration * Modified replace operation to use regexes in caddyfile * Added more tests to uri query operations
- Loading branch information
1 parent
0c01547
commit 29f57fa
Showing
4 changed files
with
263 additions
and
1 deletion.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
caddytest/integration/caddyfile_adapt/uri_query_operations.caddyfiletest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
:9080 | ||
uri query +foo bar | ||
uri query -baz | ||
uri query taz test | ||
uri query key=value example | ||
uri query changethis>changed | ||
uri query { | ||
findme value replacement | ||
+foo1 baz | ||
} | ||
|
||
respond "{query}" | ||
---------- | ||
{ | ||
"apps": { | ||
"http": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":9080" | ||
], | ||
"routes": [ | ||
{ | ||
"handle": [ | ||
{ | ||
"handler": "rewrite", | ||
"query": { | ||
"add": [ | ||
{ | ||
"key": "foo", | ||
"val": "bar" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"handler": "rewrite", | ||
"query": { | ||
"delete": [ | ||
"baz" | ||
] | ||
} | ||
}, | ||
{ | ||
"handler": "rewrite", | ||
"query": { | ||
"set": [ | ||
{ | ||
"key": "taz", | ||
"val": "test" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"handler": "rewrite", | ||
"query": { | ||
"set": [ | ||
{ | ||
"key": "key=value", | ||
"val": "example" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"handler": "rewrite", | ||
"query": { | ||
"rename": [ | ||
{ | ||
"key": "changethis", | ||
"val": "changed" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"handler": "rewrite", | ||
"query": { | ||
"add": [ | ||
{ | ||
"key": "foo1", | ||
"val": "baz" | ||
} | ||
], | ||
"replace": [ | ||
{ | ||
"key": "findme", | ||
"replace": "replacement", | ||
"search_regexp": "value" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"body": "{http.request.uri.query}", | ||
"handler": "static_response" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters