Mercurial > hg > nginx-tests
annotate js.t @ 993:3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 25 Jul 2016 16:20:37 +0300 |
parents | 882267679006 |
children | 345a655ef643 |
rev | line source |
---|---|
708 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Roman Arutyunyan | |
4 | |
5 # Tests for http JavaScript module. | |
6 | |
7 ############################################################################### | |
8 | |
9 use warnings; | |
10 use strict; | |
11 | |
12 use Test::More; | |
13 | |
14 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
15 | |
16 use lib 'lib'; | |
17 use Test::Nginx; | |
18 | |
19 ############################################################################### | |
20 | |
21 select STDERR; $| = 1; | |
22 select STDOUT; $| = 1; | |
23 | |
864
460a9cadbd2f
Tests: do not check for njs presence, just try js.t configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
709
diff
changeset
|
24 my $t = Test::Nginx->new()->has(qw/http rewrite/) |
708 | 25 ->write_file_expand('nginx.conf', <<'EOF'); |
26 | |
27 %%TEST_GLOBALS%% | |
28 | |
29 daemon off; | |
30 | |
31 events { | |
32 } | |
33 | |
34 http { | |
35 %%TEST_GLOBALS_HTTP%% | |
36 | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
37 js_set $test_method test_method; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
38 js_set $test_version test_version; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
39 js_set $test_addr test_addr; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
40 js_set $test_uri test_uri; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
41 js_set $test_hdr test_hdr; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
42 js_set $test_ihdr test_ihdr; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
43 js_set $test_arg test_arg; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
44 js_set $test_iarg test_iarg; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
45 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
46 js_include test.js; |
708 | 47 |
48 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
49 listen 127.0.0.1:8080; |
708 | 50 server_name localhost; |
51 | |
52 location /req_method { | |
53 return 200 $test_method; | |
54 } | |
55 | |
56 location /req_version { | |
57 return 200 $test_version; | |
58 } | |
59 | |
60 location /req_addr { | |
61 return 200 $test_addr; | |
62 } | |
63 | |
64 location /req_uri { | |
65 return 200 $test_uri; | |
66 } | |
67 | |
68 location /req_hdr { | |
69 return 200 $test_hdr; | |
70 } | |
71 | |
72 location /req_ihdr { | |
73 return 200 $test_ihdr; | |
74 } | |
75 | |
76 location /req_arg { | |
77 return 200 $test_arg; | |
78 } | |
79 | |
80 location /req_iarg { | |
81 return 200 $test_iarg; | |
82 } | |
83 | |
84 location /res_status { | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
85 js_content status; |
708 | 86 } |
87 | |
88 location /res_ctype { | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
89 js_content ctype; |
708 | 90 } |
91 | |
92 location /res_clen { | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
93 js_content clen; |
708 | 94 } |
95 | |
96 location /res_send { | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
97 js_content send; |
708 | 98 } |
99 | |
100 location /res_hdr { | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
101 js_content hdr; |
708 | 102 } |
103 } | |
104 } | |
105 | |
106 EOF | |
107 | |
993
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
108 $t->write_file('test.js', <<EOF); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
109 function test_method(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
110 return 'method=' + req.method; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
111 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
112 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
113 function test_version(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
114 return 'version=' + req.httpVersion; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
115 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
116 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
117 function test_addr(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
118 return 'addr=' + req.remoteAddress; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
119 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
120 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
121 function test_uri(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
122 return 'uri=' + req.uri; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
123 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
124 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
125 function test_hdr(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
126 return 'hdr=' + req.headers.foo; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
127 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
128 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
129 function test_ihdr(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
130 var s; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
131 s = ''; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
132 for (h in req.headers) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
133 if (h.substr(0, 3) == 'foo') { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
134 s += req.headers[h]; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
135 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
136 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
137 return s; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
138 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
139 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
140 function test_arg(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
141 return 'arg=' + req.args.foo; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
142 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
143 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
144 function test_iarg(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
145 var s; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
146 s = ''; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
147 for (a in req.args) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
148 if (a.substr(0, 3) == 'foo') { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
149 s += req.args[a]; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
150 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
151 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
152 return s; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
153 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
154 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
155 function status(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
156 res.status = 204; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
157 res.sendHeader(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
158 res.finish(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
159 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
160 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
161 function ctype(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
162 res.status = 200; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
163 res.contentType = 'application/foo'; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
164 res.sendHeader(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
165 res.finish(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
166 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
167 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
168 function clen(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
169 res.status = 200; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
170 res.contentLength = 5; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
171 res.sendHeader(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
172 res.send('foo12'); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
173 res.finish(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
174 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
175 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
176 function send(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
177 var a, s; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
178 res.status = 200; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
179 res.sendHeader(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
180 for (a in req.args) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
181 if (a.substr(0, 3) == 'foo') { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
182 s = req.args[a]; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
183 res.send('n=' + a + ', v=' + s.substr(0, 2) + ' '); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
184 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
185 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
186 res.finish(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
187 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
188 |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
189 function hdr(req, res) { |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
190 res.status = 200; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
191 res.headers['Foo'] = req.args.fOO; |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
192 res.sendHeader(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
193 res.finish(); |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
194 } |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
195 EOF |
3ee5ca1ec728
Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
196 |
864
460a9cadbd2f
Tests: do not check for njs presence, just try js.t configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
709
diff
changeset
|
197 $t->try_run('no njs available')->plan(13); |
708 | 198 |
199 ############################################################################### | |
200 | |
201 like(http_get('/req_method'), qr/method=GET/, 'r.method'); | |
202 like(http_get('/req_version'), qr/version=1.0/, 'r.httpVersion'); | |
203 like(http_get('/req_addr'), qr/addr=127.0.0.1/, 'r.remoteAddress'); | |
204 like(http_get('/req_uri'), qr/uri=\/req_uri/, 'r.uri'); | |
205 like(http_get_hdr('/req_hdr'), qr/hdr=12345/, 'r.headers'); | |
206 like(http_get_ihdr('/req_ihdr'), qr/12345barz/, 'r.headers iteration'); | |
207 like(http_get('/req_arg?foO=12345'), qr/arg=12345/, 'r.args'); | |
208 like(http_get('/req_iarg?foo=12345&foo2=bar&nn=22&foo-3=z'), qr/12345barz/, | |
209 'r.args iteration'); | |
210 | |
211 like(http_get('/res_status'), qr/204 No Content/, 'r.response.status'); | |
212 like(http_get('/res_ctype'), qr/Content-Type: application\/foo/, | |
213 'r.response.contentType'); | |
214 like(http_get('/res_clen'), qr/Content-Length: 5/, 'r.response.contentLength'); | |
215 like(http_get('/res_send?foo=12345&n=11&foo-2=bar&ndd=&foo-3=z'), | |
216 qr/n=foo, v=12 n=foo-2, v=ba n=foo-3, v=z/, 'r.response.send'); | |
217 like(http_get('/res_hdr?foo=12345'), qr/Foo: 12345/, 'r.response.headers'); | |
218 | |
219 ############################################################################### | |
220 | |
221 sub http_get_hdr { | |
222 my ($url, %extra) = @_; | |
223 return http(<<EOF, %extra); | |
224 GET $url HTTP/1.0 | |
225 FoO: 12345 | |
226 | |
227 EOF | |
228 } | |
229 | |
230 sub http_get_ihdr { | |
231 my ($url, %extra) = @_; | |
232 return http(<<EOF, %extra); | |
233 GET $url HTTP/1.0 | |
234 foo: 12345 | |
235 Host: localhost | |
236 foo2: bar | |
237 X-xxx: more | |
238 foo-3: z | |
239 | |
240 EOF | |
241 } | |
242 | |
243 ############################################################################### |