blob: efac8f62264903f911dd6ec0e750af4b61d8d9d8 [file] [log] [blame]
William Dauchy5417e892021-01-08 21:57:41 +01001varnishtest "json converter test"
2
3#REQUIRE_VERSION=1.6
4
5feature ignore_unknown_macro
6
7server s1 {
8 rxreq
9 txresp
10} -repeat 2 -start
11
12haproxy h1 -conf {
13 defaults
14 mode http
15 timeout connect 1s
16 timeout client 1s
17 timeout server 1s
18
19 frontend fe
20 bind "fd@${fe}"
21
22 http-response set-header json0 "%[str(foo 1/2),json]"
23 # bad UTF-8 sequence
24 http-response set-header json1 "%[str(\xE0),json(utf8)]"
25 # bad UTF-8 sequence, but removes them
26 http-response set-header json2 "%[str(-\xE0-),json(utf8s)]"
27
28 default_backend be
29
30 backend be
31 server s1 ${s1_addr}:${s1_port}
32} -start
33
34client c1 -connect ${h1_fe_sock} {
35 txreq -url "/"
36 rxresp
37 expect resp.http.json0 == "foo 1\\/2"
38 expect resp.http.json1 == ""
39 expect resp.http.json2 == "--"
40 expect resp.status == 200
41} -run