Skip to content

Commit

Permalink
updated a few examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 12, 2013
1 parent dbaf296 commit c82b314
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -526,7 +526,7 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
say $ua->get('www.☃.net?hello=there' => {DNT => 1})->res->body;
# Form POST with exception handling
my $tx = $ua->post_form('search.cpan.org/search' => {q => 'mojo'});
my $tx = $ua->post('search.cpan.org/search' => form => {q => 'mojo'});
if (my $res = $tx->success) { say $res->body }
else {
my ($err, $code) = $tx->error;
Expand Down Expand Up @@ -554,7 +554,7 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
# TLS certificate authentication and JSON POST
my $tx = $ua->cert('tls.crt')->key('tls.key')
->post_json('https://mojolicio.us' => {top => 'secret'});
->post('https://mojolicio.us' => json => {top => 'secret'});
# Blocking parallel requests (does not work inside a running event loop)
my $delay = Mojo::IOLoop->delay;
Expand Down
2 changes: 1 addition & 1 deletion lib/Test/Mojo.pm
Expand Up @@ -404,7 +404,7 @@ Test::Mojo - Testing Mojo!
$t->get_ok('/welcome')->status_is(200)->text_is('div#message' => 'Hello!');
# JSON
$t->post_form_ok('/search.json' => {q => 'Perl'})
$t->post_ok('/search.json' => form => {q => 'Perl'})
->status_is(200)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->header_isnt('X-Bender' => 'Bite my shiny metal ass!');
Expand Down

0 comments on commit c82b314

Please sign in to comment.