Skip to content

Instantly share code, notes, and snippets.

@hoelzro
Created June 13, 2011 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoelzro/1023441 to your computer and use it in GitHub Desktop.
Save hoelzro/1023441 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More tests => 1;
use Plack::Test;
$Plack::Test::Impl = 'AnyEvent';
test_psgi $app, sub {
my ( $cb ) = @_;
my $res = $cb->(GET '/changes.json');
is $res->header('Transfer-Encoding'), 'chunked';
is $res->content_type, 'application/json';
is $res->body, '';
$res->on_body_received(sub {
my ( $chunk ) = @_;
## do something with $chunk
if($done) {
$res->send;
}
});
$res->recv;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment