|
1 | 1 | #!/usr/bin/env perl |
2 | 2 |
|
3 | | -use Test::More tests => 194; |
| 3 | +use Test::More tests => 224; |
4 | 4 | use Data::Dumper; |
5 | 5 | use FindBin; |
6 | 6 | use lib "$FindBin::Bin/.."; |
|
255 | 255 | [["GET /test1 HTTP/1.1\nHost:localhost\nConnection:close\n\n"], 500, {}, "Request not handled\nGET /test1\n" ], |
256 | 256 | if ALL; |
257 | 257 |
|
| 258 | +test_server { |
| 259 | + return 204, undef, headers => {}; |
| 260 | +} '204 - no cl - undef', |
| 261 | + [["GET /test1 HTTP/1.1\nHost:localhost\nConnection:keep-alive\n\n"], 204, { 'content-length' => undef }, "" ], |
| 262 | +if ALL; |
| 263 | + |
| 264 | +test_server { |
| 265 | + return 204, "", headers => {}; |
| 266 | +} '204 - no cl - empty', |
| 267 | + [["GET /test1 HTTP/1.1\nHost:localhost\nConnection:keep-alive\n\n"], 204, { 'content-length' => undef }, "" ], |
| 268 | +if ALL; |
| 269 | + |
| 270 | +test_server { |
| 271 | + my $s = shift; |
| 272 | + my $r = shift; |
| 273 | + return 204, "some content", headers => {}; |
| 274 | +} '204 - with content', |
| 275 | + [["GET /test1 HTTP/1.1\nHost:localhost\nConnection:keep-alive\n\n"], 204, { 'content-length' => undef }, "" ], |
| 276 | +if ALL; |
| 277 | + |
| 278 | +test_server { |
| 279 | + my $s = shift; |
| 280 | + my $r = shift; |
| 281 | + return 204, "", headers => {'content-length' => 0}; |
| 282 | +} '204 - with header', |
| 283 | + [["GET /test1 HTTP/1.1\nHost:localhost\nConnection:keep-alive\n\n"], 204, { 'content-length' => undef }, "" ], |
| 284 | +if ALL; |
| 285 | + |
| 286 | +test_server { |
| 287 | + my $s = shift; |
| 288 | + my $r = shift; |
| 289 | + return 200, undef; |
| 290 | +} '200 - with undef body', |
| 291 | + [["GET /test1 HTTP/1.1\nHost:localhost\nConnection:keep-alive\n\n"], 200, { 'content-length' => 0 }, "" ], |
| 292 | +if ALL; |
| 293 | + |
258 | 294 | } |
259 | 295 |
|
260 | 296 | done_testing(); |
0 commit comments