aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddytest/integration/caddyfile_adapt
diff options
context:
space:
mode:
authorAziz Rmadi <[email protected]>2024-03-21 21:23:42 -0500
committerGitHub <[email protected]>2024-03-22 02:23:42 +0000
commit29f57faa8679344fa40ea9b317d724f0604d5b40 (patch)
tree75bad323296c89eea84ba7804a79e132b55955e3 /caddytest/integration/caddyfile_adapt
parent0c01547037925016921e6b73f232a5f8758a8c08 (diff)
downloadcaddy-29f57faa8679344fa40ea9b317d724f0604d5b40.tar.gz
caddy-29f57faa8679344fa40ea9b317d724f0604d5b40.zip
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
Diffstat (limited to 'caddytest/integration/caddyfile_adapt')
-rw-r--r--caddytest/integration/caddyfile_adapt/uri_query_operations.caddyfiletest106
1 files changed, 106 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/uri_query_operations.caddyfiletest b/caddytest/integration/caddyfile_adapt/uri_query_operations.caddyfiletest
new file mode 100644
index 000000000..a53462480
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/uri_query_operations.caddyfiletest
@@ -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"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file