about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-03-05 05:41:12 +0000
committerEric Wong <e@80x24.org>2016-03-05 05:41:12 +0000
commit5186d1f71d83ad84104c93da6bd27908a1610403 (patch)
treeec04ec66332e89fa3d2cb7c661a9580260e1ccbe /t
parent310819ea86ac7f85d39a2a8720c4d179c8c94277 (diff)
downloadpublic-inbox-5186d1f71d83ad84104c93da6bd27908a1610403.tar.gz
Just to ensure we hit the code path independently of
WWW code.
Diffstat (limited to 't')
-rw-r--r--t/httpd-corner.psgi9
-rw-r--r--t/httpd-corner.t9
2 files changed, 18 insertions, 0 deletions
diff --git a/t/httpd-corner.psgi b/t/httpd-corner.psgi
index 349b35df..da8a2ee8 100644
--- a/t/httpd-corner.psgi
+++ b/t/httpd-corner.psgi
@@ -47,6 +47,15 @@ my $app = sub {
         } elsif ($path eq '/host-port') {
                 $code = 200;
                 push @$body, "$env->{REMOTE_ADDR}:$env->{REMOTE_PORT}";
+        } elsif ($path eq '/callback') {
+                return sub {
+                        my ($res) = @_;
+                        my $buf = "hello world\n";
+                        push @$h, 'Content-Length', length($buf);
+                        my $fh = $res->([200, $h]);
+                        $fh->write($buf);
+                        $fh->close;
+                }
         }
 
         [ $code, $h, $body ]
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index 19564074..a6238e48 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -76,6 +76,15 @@ my $spawn_httpd = sub {
         $spawn_httpd->('-W0');
 }
 
+{
+        my $conn = conn_for($sock, 'streaming callback');
+        $conn->write("GET /callback HTTP/1.0\r\n\r\n");
+        ok($conn->read(my $buf, 8192), 'read response');
+        my ($head, $body) = split(/\r\n\r\n/, $buf);
+        is($body, "hello world\n", 'callback body matches expected');
+}
+
+
 # Unix domain sockets
 {
         my $u = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => $upath);