On Tue, 14 Mar 2017, Joel Berger wrote:
> All that said, you don't even need to do this manually. If you add your
> username and password to the request url Mojo::UserAgent will just build
> this header for you. See the example
> here: http://mojolicious.org/perldoc/Mojo/UserAgent#SYNOPSIS
Note however that you shouldn't do this:
my $value =
$ua->get("https://$user:[email protected]/test.json")->result->json;
if your password might contain @. You will find part of your password
leaking out via DNS lookups.
I think:
Mojo::URL->new('https://example.com/test.json')->username($user)->password($pass)
is safe.