Tests: perl module.
This commit is contained in:
5
test/perl/body_array/psgi.pl
Normal file
5
test/perl/body_array/psgi.pl
Normal file
@@ -0,0 +1,5 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
return ['200', ['Content-Length' => '10'], ['012', '345', '678', '9']];
|
||||
};
|
||||
5
test/perl/body_empty/psgi.pl
Normal file
5
test/perl/body_empty/psgi.pl
Normal file
@@ -0,0 +1,5 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
return ['200', [], []];
|
||||
};
|
||||
9
test/perl/body_io_empty/psgi.pl
Normal file
9
test/perl/body_io_empty/psgi.pl
Normal file
@@ -0,0 +1,9 @@
|
||||
use IO::Handle;
|
||||
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
my $io = IO::Handle->new();
|
||||
|
||||
return ['200', [], $io];
|
||||
};
|
||||
1
test/perl/body_io_file/file
Normal file
1
test/perl/body_io_file/file
Normal file
@@ -0,0 +1 @@
|
||||
body
|
||||
7
test/perl/body_io_file/psgi.pl
Normal file
7
test/perl/body_io_file/psgi.pl
Normal file
@@ -0,0 +1,7 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
open my $io, '<file';
|
||||
|
||||
return ['200', ['Content-Length' => 5], $io];
|
||||
};
|
||||
7
test/perl/errors_print/psgi.pl
Normal file
7
test/perl/errors_print/psgi.pl
Normal file
@@ -0,0 +1,7 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
my $result = $environ->{'psgi.errors'}->print('Error in application');
|
||||
|
||||
return ['200', ['Content-Length' => '1'], [$result]];
|
||||
};
|
||||
5
test/perl/header_pairs/psgi.pl
Normal file
5
test/perl/header_pairs/psgi.pl
Normal file
@@ -0,0 +1,5 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
return ['200', ['Content-Length', 0, 'blah', 'blah'], []];
|
||||
};
|
||||
10
test/perl/input_copy/psgi.pl
Normal file
10
test/perl/input_copy/psgi.pl
Normal file
@@ -0,0 +1,10 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
open(my $fh, ">&", $environ->{'psgi.input'});
|
||||
|
||||
my $len = int($environ->{'CONTENT_LENGTH'});
|
||||
$fh->read(my $body, $len);
|
||||
|
||||
return ['200', ['Content-Length' => $len], [$body]];
|
||||
};
|
||||
7
test/perl/input_read_empty/psgi.pl
Normal file
7
test/perl/input_read_empty/psgi.pl
Normal file
@@ -0,0 +1,7 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
$len = $environ->{'psgi.input'}->read(my $body, 1024);
|
||||
|
||||
return ['200', ['Content-Length' => $len], [$body]];
|
||||
};
|
||||
7
test/perl/input_read_offset/psgi.pl
Normal file
7
test/perl/input_read_offset/psgi.pl
Normal file
@@ -0,0 +1,7 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
$environ->{'psgi.input'}->read(my $body, 4, 4);
|
||||
|
||||
return ['200', ['Content-Length' => 4], [$body]];
|
||||
};
|
||||
8
test/perl/query_string/psgi.pl
Normal file
8
test/perl/query_string/psgi.pl
Normal file
@@ -0,0 +1,8 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
return ['200', [
|
||||
'Content-Length' => 0,
|
||||
'Query-String' => $environ->{'QUERY_STRING'}
|
||||
], []];
|
||||
};
|
||||
8
test/perl/server_port/psgi.pl
Normal file
8
test/perl/server_port/psgi.pl
Normal file
@@ -0,0 +1,8 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
return ['200', [
|
||||
'Content-Length' => 0,
|
||||
'Server-Port' => $environ->{'SERVER_PORT'}
|
||||
], []];
|
||||
};
|
||||
16
test/perl/variables/psgi.pl
Normal file
16
test/perl/variables/psgi.pl
Normal file
@@ -0,0 +1,16 @@
|
||||
my $app = sub {
|
||||
my ($environ) = @_;
|
||||
|
||||
my $len = int($environ->{'CONTENT_LENGTH'});
|
||||
$environ->{'psgi.input'}->read(my $body, $len);
|
||||
|
||||
return ['200', [
|
||||
'Content-Type' => $environ->{'CONTENT_TYPE'},
|
||||
'Content-Length' => $len,
|
||||
'Request-Method' => $environ->{'REQUEST_METHOD'},
|
||||
'Request-Uri' => $environ->{'REQUEST_URI'},
|
||||
'Http-Host' => $environ->{'HTTP_HOST'},
|
||||
'Server-Protocol' => $environ->{'SERVER_PROTOCOL'},
|
||||
'Custom-Header' => $environ->{'HTTP_CUSTOM_HEADER'}
|
||||
], [$body]];
|
||||
};
|
||||
Reference in New Issue
Block a user