11
unless ($ENV{TEST_LIVE}) {
12
plan skip_all => "Enable live testing by setting env: TEST_LIVE=1";
16
die "Fail to fork then start a plack server" unless defined $pid;
19
require Plack::Runner;
20
my $runner = Plack::Runner->new;
21
$runner->parse_options("--port", "5002", "$FindBin::Bin/bin/head-request.psgi");
26
sleep 5; # hopfully this is enough to launch that psgi.
35
subtest "expect HEAD response with a Content-Length" => sub {
36
my $res = Hijk::request({%args, query_string => "gimme_content_length=1"});
37
ok !exists $res->{error}, '$res->{error} should not exist because this request should have been successful';
38
cmp_ok $res->{head}->{"Content-Length"}, "==", 11, "Got a Content-Length";
39
cmp_ok $res->{body}, "eq", "", "Got no body even though we had a Content-Length";
42
subtest "expect HEAD response without a Content-Length" => sub {
43
my $res = Hijk::request({%args, query_string => "gimme_content_length="});
44
ok !exists $res->{error}, '$res->{error} should not exist because this request should have been successful';
46
local $TODO = "I can't figure out how to get plackup(1) not to implicitly add Content-Length";
47
ok !exists $res->{head}->{"Content-Length"}, "We should get no Content-Length";
49
cmp_ok $res->{body}, "eq", "", "Got no body wit the HEAD response, also have no Content-Length";
52
END { kill INT => $pid if $pid }