forked from plack/Plack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request plack#276 from wreis/head_streaming
Add support for streaming app to P::M::Head
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use strict; | ||
use Test::More; | ||
use Plack::Test; | ||
use Plack::Builder; | ||
use HTTP::Request::Common; | ||
|
||
my $app = sub { | ||
my $env = shift; | ||
return sub { | ||
my $writer = shift->( [ 200, [ | ||
'Content-Type' => 'text/plain', | ||
] ] ); | ||
$writer->write($_) for qw{Hello World}; | ||
$writer->close; | ||
}; | ||
}; | ||
|
||
$app = builder { enable "Head"; $app }; | ||
|
||
test_psgi $app, sub { | ||
my $cb = shift; | ||
|
||
my $res = $cb->(GET "/"); | ||
is $res->content, "HelloWorld"; | ||
|
||
$res = $cb->(HEAD "/"); | ||
ok !$res->content; | ||
ok(!$res->content_length); | ||
}; | ||
|
||
done_testing; | ||
|