Skip to content

Commit

Permalink
test gzip support in Mojo::UserAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 7, 2012
1 parent 0148799 commit ae63a8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

3.55 2012-11-06
3.55 2012-11-07
- Added gzip support to Mojo::UserAgent.
- Added is_compressed method to Mojo::Content.
- Improved documentation.
Expand Down
7 changes: 5 additions & 2 deletions t/mojo/user_agent.t
Expand Up @@ -7,6 +7,7 @@ BEGIN {
}

use Test::More;
use IO::Compress::Gzip 'gzip';
use Mojo::IOLoop;
use Mojo::UserAgent;
use Mojolicious::Lite;
Expand Down Expand Up @@ -40,7 +41,9 @@ get '/no_content' => {text => 'fail!', status => 204};
# GET /echo
get '/echo' => sub {
my $self = shift;
$self->render_data($self->req->body);
gzip \(my $uncompressed = $self->req->body), \my $compressed;
$self->res->headers->content_encoding($self->req->headers->accept_encoding);
$self->render_data($compressed);
};

# POST /echo
Expand Down Expand Up @@ -353,7 +356,7 @@ like $res, qr|^HTTP/.*200 OK.*works!$|s, 'right response';
$ua->unsubscribe(start => $start);
ok !$ua->has_subscribers('start'), 'unsubscribed successfully';

# GET /echo (stream with drain callback)
# GET /echo (stream with drain callback and compressed response)
$tx = $ua->build_tx(GET => '/echo');
my $i = 0;
my ($stream, $drain);
Expand Down

0 comments on commit ae63a8f

Please sign in to comment.