summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/perl/delayed_response/psgi.pl10
-rw-r--r--test/perl/streaming_body/psgi.pl13
-rw-r--r--test/test_perl_application.py16
3 files changed, 39 insertions, 0 deletions
diff --git a/test/perl/delayed_response/psgi.pl b/test/perl/delayed_response/psgi.pl
new file mode 100644
index 00000000..f934c3a7
--- /dev/null
+++ b/test/perl/delayed_response/psgi.pl
@@ -0,0 +1,10 @@
+my $app = sub {
+ my ($environ) = @_;
+
+ return sub {
+ (my $responder = shift)->([200, [
+ 'Content-Type' => 'text/plain',
+ 'Content-Length' => '12'
+ ], ["Hello World!"]]);
+ }
+};
diff --git a/test/perl/streaming_body/psgi.pl b/test/perl/streaming_body/psgi.pl
new file mode 100644
index 00000000..a3e54ee0
--- /dev/null
+++ b/test/perl/streaming_body/psgi.pl
@@ -0,0 +1,13 @@
+my $app = sub {
+ my ($environ) = @_;
+
+ return sub {
+ my $writer = (my $responder = shift)->([200, [
+ 'Content-Type' => 'text/plain',
+ 'Content-Length' => '12'
+ ]]);
+
+ $writer->write("Hello World!");
+ $writer->close;
+ };
+};
diff --git a/test/test_perl_application.py b/test/test_perl_application.py
index 4609c2bd..b169baab 100644
--- a/test/test_perl_application.py
+++ b/test/test_perl_application.py
@@ -200,5 +200,21 @@ class TestUnitPerlApplication(unit.TestUnitApplicationPerl):
self.search_in_log(r'\[error\].+IOFake close\(\) called'),
'body io fake close')
+ def test_perl_delayed_response(self):
+ self.load('delayed_response')
+
+ resp = self.get()
+
+ self.assertEqual(resp['status'], 200, 'status')
+ self.assertEqual(resp['body'], 'Hello World!', 'body')
+
+ def test_perl_streaming_body(self):
+ self.load('streaming_body')
+
+ resp = self.get()
+
+ self.assertEqual(resp['status'], 200, 'status')
+ self.assertEqual(resp['body'], 'Hello World!', 'body')
+
if __name__ == '__main__':
TestUnitPerlApplication.main()