blob: 3a031a683e44869f62e5f692c36581627bd6235f [file] [log] [blame]
Nikola Sale0dbf0382022-04-03 18:11:53 +02001varnishtest "be2dec converter Test"
2
3feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.6-dev0)'"
4feature ignore_unknown_macro
5
6server s1 {
7 rxreq
8 txresp
9} -repeat 3 -start
10
11haproxy h1 -conf {
12 defaults
13 mode http
14 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
15 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
16 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
17
18 frontend fe
19 bind "fd@${fe}"
20
21 #### requests
22 http-request set-var(txn.input) req.hdr(input)
23 http-request set-var(txn.var) str("var_content")
24
25 http-response set-header add_item-1 "%[var(txn.input),add_item(',',txn.var,_suff_)]"
26 http-response set-header add_item-2 "%[var(txn.input),add_item(',',txn.var)]"
27 http-response set-header add_item-3 "%[var(txn.input),add_item(',',,_suff_)]"
28
29 default_backend be
30
31 backend be
32 server s1 ${s1_addr}:${s1_port}
33} -start
34
35client c1 -connect ${h1_fe_sock} {
36 txreq -url "/" \
37 -hdr "input:"
38 rxresp
39 expect resp.status == 200
40 expect resp.http.add_item-1 == "var_content_suff_"
41 expect resp.http.add_item-2 == "var_content"
42 expect resp.http.add_item-3 == "_suff_"
43 txreq -url "/" \
44 -hdr "input: input_string"
45 rxresp
46 expect resp.status == 200
47 expect resp.http.add_item-1 == "input_string,var_content_suff_"
48 expect resp.http.add_item-2 == "input_string,var_content"
49 expect resp.http.add_item-3 == "input_string,_suff_"
50} -run