about summary refs log tree commit homepage
path: root/t/httpd-corner.psgi
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-08-04 23:36:34 +0000
committerEric Wong <e@80x24.org>2016-08-05 02:26:26 +0000
commitaf65e06b3ba65952f1223e09b9df0736965bdaeb (patch)
treed657e48ce387fc6a9e7f569e789f5ae4616f8c0b /t/httpd-corner.psgi
parent1203c8b745adfe6f0717e410ce1636260b5d9e46 (diff)
downloadpublic-inbox-af65e06b3ba65952f1223e09b9df0736965bdaeb.tar.gz
PSGI applications (like our WWW :P) can fail unpredictability,
but lets try to avoid bringing the entire process down when this
happens.
Diffstat (limited to 't/httpd-corner.psgi')
-rw-r--r--t/httpd-corner.psgi12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/httpd-corner.psgi b/t/httpd-corner.psgi
index 222b9e01..ed1f92c0 100644
--- a/t/httpd-corner.psgi
+++ b/t/httpd-corner.psgi
@@ -60,6 +60,18 @@ my $app = sub {
                 }
         } elsif ($path eq '/empty') {
                 $code = 200;
+        } elsif ($path eq '/getline-die') {
+                $code = 200;
+                $body = Plack::Util::inline_object(
+                        getline => sub { die 'GETLINE FAIL' },
+                        close => sub { die 'CLOSE FAIL' },
+                );
+        } elsif ($path eq '/close-die') {
+                $code = 200;
+                $body = Plack::Util::inline_object(
+                        getline => sub { undef },
+                        close => sub { die 'CLOSE FAIL' },
+                );
         }
 
         [ $code, $h, $body ]