Skip to content

Commit

Permalink
relative URLs with userinfo are a feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 6, 2015
1 parent a4c2c80 commit 4256b8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/Mojolicious/Command/get.pm
Expand Up @@ -128,6 +128,7 @@ Mojolicious::Command::get - Get command
Usage: APPLICATION get [OPTIONS] URL [SELECTOR|JSON-POINTER] [COMMANDS]
./myapp.pl get /
./myapp.pl get //sri:secr3t@/secrets.json /1/content
mojo get mojolicio.us
mojo get -v -r google.com
mojo get -v -H 'Host: mojolicious.org' -H 'Accept: */*' mojolicio.us
Expand Down
5 changes: 5 additions & 0 deletions lib/Test/Mojo.pm
Expand Up @@ -660,6 +660,11 @@ arguments as L<Mojo::UserAgent/"get">, except for the callback.
# Run tests against remote host
$t->get_ok('http://mojolicio.us/perldoc')->status_is(200);
# Use relative URL for request with Basic authentication
$t->get_ok('//sri:secr3t@/secrets.json')
->status_is(200)
->json_is('/1/content', 'Mojo rocks!');
# Run additional tests on the transaction
$t->get_ok('/foo')->status_is(200);
is $t->tx->res->dom->at('input')->{value}, 'whatever', 'right value';
Expand Down
5 changes: 2 additions & 3 deletions t/mojolicious/lite_app.t
Expand Up @@ -685,9 +685,8 @@ $t->get_ok('/regex/in/template')->status_is(200)
->content_is("test(test)(\\Qtest\\E)(\n");

# Chunked response with basic auth
my $url = $t->ua->server->url->userinfo('sri:foo')->path('/stream')
->query(foo => 'bar');
$t->get_ok($url)->status_is(200)->header_is(Server => 'Mojolicious (Perl)')
$t->get_ok('//sri:foo@/stream' => form => {foo => 'bar'})->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->content_like(qr!^foobarsri:foohttp://127\.0\.0\.1:\d+/stream$!);

# Not ajax
Expand Down

0 comments on commit 4256b8d

Please sign in to comment.