From 28bdeec614d21d0ff2309431354e8cc389aac208 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Tue, 14 Mar 2023 11:06:09 +0000 Subject: Tests: added Perl test with many responses using streaming body. --- test/perl/streaming_body_multiple_responses/psgi.pl | 11 +++++++++++ test/test_perl_application.py | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 test/perl/streaming_body_multiple_responses/psgi.pl diff --git a/test/perl/streaming_body_multiple_responses/psgi.pl b/test/perl/streaming_body_multiple_responses/psgi.pl new file mode 100644 index 00000000..ffd026bd --- /dev/null +++ b/test/perl/streaming_body_multiple_responses/psgi.pl @@ -0,0 +1,11 @@ +my $counter = 2; + +my $app = sub { + my $env = shift; + + return sub { + my $responder = shift; + $responder->([200, ['Content-Type'=>'text/plain'], [$counter++]]); + $responder->([200, ['Content-Type'=>'text/plain'], [$counter++]]); + }; +}; diff --git a/test/test_perl_application.py b/test/test_perl_application.py index fe2db72e..3c327aa1 100644 --- a/test/test_perl_application.py +++ b/test/test_perl_application.py @@ -179,6 +179,11 @@ class TestPerlApplication(TestApplicationPerl): assert self.get()['body'] == 'body\n', 'body io file' + def test_perl_streaming_body_multiple_responses(self): + self.load('streaming_body_multiple_responses') + + assert self.get()['status'] == 200 + @pytest.mark.skip('not yet') def test_perl_application_syntax_error(self, skip_alert): skip_alert(r'PSGI: Failed to parse script') -- cgit