about summary refs log tree commit homepage
path: root/t/plack.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-01-04 09:14:48 +0000
committerEric Wong <e@80x24.org>2019-01-04 09:16:04 +0000
commitbfcbbb30ef2001d18219079a7379eb9c99d16cdc (patch)
treef458b936b50dc91b8b2eb6594c8688508475a87e /t/plack.t
parent2acb572e34cabd06292bde615bdab54b3f54edd9 (diff)
downloadpublic-inbox-bfcbbb30ef2001d18219079a7379eb9c99d16cdc.tar.gz
No need to test this via CGI .cgi is a wrapper around
PSGI and PSGI tests are way faster.
Diffstat (limited to 't/plack.t')
-rw-r--r--t/plack.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/plack.t b/t/plack.t
index 1a719b41..14c9b657 100644
--- a/t/plack.t
+++ b/t/plack.t
@@ -220,6 +220,26 @@ EOF
                                 'redirect from x40 MIDs works');
                 }
         });
+
+        # dumb HTTP clone/fetch support
+        test_psgi($app, sub {
+                my ($cb) = @_;
+                my $path = '/test/info/refs';
+                my $req = HTTP::Request->new('GET' => $path);
+                my $res = $cb->($req);
+                is(200, $res->code, 'refs readable');
+                my $orig = $res->content;
+
+                $req->header('Range', 'bytes=5-10');
+                $res = $cb->($req);
+                is(206, $res->code, 'got partial response');
+                is($res->content, substr($orig, 5, 6), 'partial body OK');
+
+                $req->header('Range', 'bytes=5-');
+                $res = $cb->($req);
+                is(206, $res->code, 'got partial another response');
+                is($res->content, substr($orig, 5), 'partial body OK past end');
+        });
 }
 
 done_testing();