Skip to content

Commit

Permalink
mix URLs with and without scheme in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 25, 2012
1 parent 7998c53 commit 4d23e17
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
24 changes: 12 additions & 12 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -555,8 +555,8 @@ Mojo::UserAgent - Non-blocking I/O HTTP 1.1 and WebSocket user agent
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
# Say hello to the unicode snowman
say $ua->get('www.☃.net?hello=there')->res->body;
# Say hello to the unicode snowman with "Do Not Track" header
say $ua->get('www.☃.net?hello=there' => {DNT => 1})->res->body;
# Quick JSON API request with Basic authentication
say $ua->get('https://sri:s3cret@search.twitter.com/search.json?q=perl')
Expand Down Expand Up @@ -840,15 +840,15 @@ Get absolute L<Mojo::URL> object for C<app> and switch protocol if necessary.
=head2 C<build_form_tx>
my $tx = $ua->build_form_tx('kraih.com' => {a => 'b'});
my $tx = $ua->build_form_tx('http://kraih.com' => {a => 'b'});
my $tx = $ua->build_form_tx('kraih.com', 'UTF-8', {a => 'b'}, {DNT => 1});
Alias for L<Mojo::UserAgent::Transactor/"form">.
=head2 C<build_tx>
my $tx = $ua->build_tx(GET => 'kraih.com');
my $tx = $ua->build_tx(PUT => 'kraih.com' => {DNT => 1} => 'Hi!');
my $tx = $ua->build_tx(PUT => 'http://kraih.com' => {DNT => 1} => 'Hi!');
Alias for L<Mojo::UserAgent::Transactor/"tx">.
Expand All @@ -861,7 +861,7 @@ Alias for L<Mojo::UserAgent::Transactor/"websocket">.
=head2 C<delete>
my $tx = $ua->delete('http://kraih.com');
my $tx = $ua->delete('kraih.com');
my $tx = $ua->delete('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<DELETE> request and return resulting
Expand All @@ -885,7 +885,7 @@ proxy detection can be enabled with the C<MOJO_PROXY> environment variable.
=head2 C<get>
my $tx = $ua->get('http://kraih.com');
my $tx = $ua->get('kraih.com');
my $tx = $ua->get('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<GET> request and return resulting
Expand All @@ -901,7 +901,7 @@ append a callback to perform requests non-blocking.
=head2 C<head>
my $tx = $ua->head('http://kraih.com');
my $tx = $ua->head('kraih.com');
my $tx = $ua->head('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<HEAD> request and return resulting
Expand All @@ -923,7 +923,7 @@ Check if request for domain would use a proxy server.
=head2 C<options>
my $tx = $ua->options('http://kraih.com');
my $tx = $ua->options('kraih.com');
my $tx = $ua->options('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<OPTIONS> request and return resulting
Expand All @@ -939,7 +939,7 @@ append a callback to perform requests non-blocking.
=head2 C<patch>
my $tx = $ua->patch('http://kraih.com');
my $tx = $ua->patch('kraih.com');
my $tx = $ua->patch('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<PATCH> request and return resulting
Expand All @@ -955,7 +955,7 @@ append a callback to perform requests non-blocking.
=head2 C<post>
my $tx = $ua->post('http://kraih.com');
my $tx = $ua->post('kraih.com');
my $tx = $ua->post('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<POST> request and return resulting
Expand All @@ -971,7 +971,7 @@ append a callback to perform requests non-blocking.
=head2 C<post_form>
my $tx = $ua->post_form('kraih.com' => {a => 'b'});
my $tx = $ua->post_form('http://kraih.com' => {a => 'b'});
my $tx = $ua->post_form('kraih.com', 'UTF-8', {a => 'b'}, {DNT => 1});
Perform blocking HTTP C<POST> request with form data and return resulting
Expand All @@ -987,7 +987,7 @@ perform requests non-blocking.
=head2 C<put>
my $tx = $ua->put('http://kraih.com');
my $tx = $ua->put('kraih.com');
my $tx = $ua->put('http://kraih.com' => {DNT => 1} => 'Hi!');
Perform blocking HTTP C<PUT> request and return resulting
Expand Down
1 change: 1 addition & 0 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -284,6 +284,7 @@ implements the following new ones.
=head2 C<form>
my $tx = $t->form('kraih.com' => {a => 'b'});
my $tx = $t->form('http://kraih.com' => {a => 'b'});
my $tx = $t->form('http://kraih.com' => {mytext => {file => '/foo.txt'}});
my $tx = $t->form('http://kraih.com' => {mytext => {content => 'lalala'}});
Expand Down
16 changes: 8 additions & 8 deletions lib/ojo.pm
Expand Up @@ -117,23 +117,23 @@ Turn list into a L<Mojo::Collection> object.
=head2 C<d>
my $res = d('http://mojolicio.us');
my $res = d('mojolicio.us');
my $res = d('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<DELETE> request with L<Mojo::UserAgent/"delete"> and return
resulting L<Mojo::Message::Response> object.
=head2 C<f>
my $res = f('kraih.com' => {a => 'b'});
my $res = f('http://kraih.com' => {a => 'b'});
my $res = f('kraih.com' => 'UTF-8' => {a => 'b'} => {DNT => 1});
Perform C<POST> form request with L<Mojo::UserAgent/"post_form"> and return
resulting L<Mojo::Message::Response> object.
=head2 C<g>
my $res = g('http://mojolicio.us');
my $res = g('mojolicio.us');
my $res = g('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<GET> request with L<Mojo::UserAgent/"get"> and return resulting
Expand All @@ -145,39 +145,39 @@ variable.
=head2 C<h>
my $res = h('http://mojolicio.us');
my $res = h('mojolicio.us');
my $res = h('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<HEAD> request with L<Mojo::UserAgent/"head"> and return resulting
L<Mojo::Message::Response> object.
=head2 C<o>
my $res = o('http://mojolicio.us');
my $res = o('mojolicio.us');
my $res = o('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<OPTIONS> request with L<Mojo::UserAgent/"options"> and return
resulting L<Mojo::Message::Response> object.
=head2 C<p>
my $res = p('http://mojolicio.us');
my $res = p('mojolicio.us');
my $res = p('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<POST> request with L<Mojo::UserAgent/"post"> and return resulting
L<Mojo::Message::Response> object.
=head2 C<t>
my $res = t('http://mojolicio.us');
my $res = t('mojolicio.us');
my $res = t('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<PATCH> request with L<Mojo::UserAgent/"patch"> and return resulting
L<Mojo::Message::Response> object.
=head2 C<u>
my $res = u('http://mojolicio.us');
my $res = u('mojolicio.us');
my $res = u('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<PUT> request with L<Mojo::UserAgent/"put"> and return resulting
Expand Down

0 comments on commit 4d23e17

Please sign in to comment.