Skip to content

Commit

Permalink
more realistic user agent examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 2, 2014
1 parent 70f4911 commit 1d5d6b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -678,12 +678,12 @@ L<Mojo::UserAgent::Transactor/"tx">.
# Request with custom cookie
my $tx = $ua->build_tx(GET => 'example.com');
$tx->req->cookies({name => 'foo', value => 'bar'});
$ua->start($tx);
$tx = $ua->start($tx);
# Deactivate gzip compression
my $tx = $ua->build_tx(GET => 'example.com');
$tx->req->headers->remove('Accept-Encoding');
$ua->start($tx);
$tx = $ua->start($tx);
# Interrupt response by raising an error
my $tx = $ua->build_tx(GET => 'example.com');
Expand All @@ -692,7 +692,7 @@ L<Mojo::UserAgent::Transactor/"tx">.
return unless my $server = $res->headers->server;
$res->error('Oh noes, it is IIS!') if $server =~ /IIS/;
});
$ua->start($tx);
$tx = $ua->start($tx);
=head2 build_websocket_tx
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -946,7 +946,7 @@ L<Mojo::UserAgent> makes it actually easy.
});

# Process transaction
$ua->start($tx);
$tx = $ua->start($tx);

The event L<Mojo::Content/"read"> will be emitted for every chunk of data that
is received, even C<chunked> encoding will be handled transparently if
Expand Down Expand Up @@ -977,7 +977,7 @@ Sending a streaming request is almost just as easy.
$tx->req->content->$drain;

# Process transaction
$ua->start($tx);
$tx = $ua->start($tx);

The drain callback passed to L<Mojo::Content/"write"> will be invoked whenever
the entire previous chunk has actually been written.
Expand Down

0 comments on commit 1d5d6b9

Please sign in to comment.