Skip to content

Commit f4c807d

Browse files
committed
Adds a proxy verifier test
1 parent 19a0c5a commit f4c807d

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

tests/gold_tests/pluginTest/header_rewrite/header_rewrite_bundle.replay.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ autest:
138138
args:
139139
- "rules/nested_ifs.conf"
140140

141+
- from: "http://www.example.com/from_13/"
142+
to: "http://backend.ex:{SERVER_HTTP_PORT}/to_13/"
143+
plugins:
144+
- name: "header_rewrite.so"
145+
args:
146+
- "rules/query_sub_key.conf"
147+
141148

142149

143150
# Proxy verifier sessions
@@ -1019,3 +1026,51 @@ sessions:
10191026
- [ X-Foo-And-Fie, { as: absent } ]
10201027
- [ X-Fie-Anywhere, { value: "Yes", as: equal } ]
10211028
- [ X-When-200-After, { value: "Yes", as: equal } ]
1029+
1030+
# Test 28: Query parameter sub-key extraction
1031+
- transactions:
1032+
- client-request:
1033+
method: "GET"
1034+
version: "1.1"
1035+
url: /from_13/?sub=Hello
1036+
headers:
1037+
fields:
1038+
- [ Host, www.example.com ]
1039+
- [ uuid, 34 ]
1040+
1041+
server-response:
1042+
status: 200
1043+
reason: OK
1044+
headers:
1045+
fields:
1046+
- [ Connection, close ]
1047+
1048+
proxy-response:
1049+
status: 200
1050+
headers:
1051+
fields:
1052+
- [ X-Query-Sub, { value: "Hello", as: equal } ]
1053+
1054+
# Test 29: Query parameter sub-key - parameter not present
1055+
- transactions:
1056+
- client-request:
1057+
method: "GET"
1058+
version: "1.1"
1059+
url: /from_13/?other=value
1060+
headers:
1061+
fields:
1062+
- [ Host, www.example.com ]
1063+
- [ uuid, 35 ]
1064+
1065+
server-response:
1066+
status: 200
1067+
reason: OK
1068+
headers:
1069+
fields:
1070+
- [ Connection, close ]
1071+
1072+
proxy-response:
1073+
status: 200
1074+
headers:
1075+
fields:
1076+
- [ X-Query-Sub, { as: absent } ]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# Test query parameter sub-key extraction
19+
cond %{SEND_RESPONSE_HDR_HOOK} [AND]
20+
cond %{CLIENT-URL:QUERY:sub} ="" [NOT]
21+
set-header X-Query-Sub "%{CLIENT-URL:QUERY:sub}"

0 commit comments

Comments
 (0)