Mojo::UserAgent is an HTTP client for Perl included with the Mojolicious web framework.
Questions tagged [mojo-useragent]
26 questions
9
votes
2 answers
Mojo::UserAgent and JavaScript
I wondering if something like the below could be possible to do with Mojo::UserAgent :
let's say i have the below code :
my $ua = Mojo::UserAgent->new;
my $res = $ua->get('mojolicious.org/perldoc')->result;
is it possible to intercept…

jsor
- 637
- 4
- 10
8
votes
1 answer
Mojo::UserAgent - Inspect the Content-Encoding header before decoding
I'm attempting use Mojo::UserAgent to verify the gzip compression (Content-Encoding) of an application.
Unfortunately, it appears that this UA silently decodes the content and removes the Content-Encoding header afterwords.
The following is my…

Miller
- 34,962
- 4
- 39
- 60
6
votes
1 answer
How to PUT a file using Mojo::Useragent?
I am trying to use the PUT method to upload a file using Mojo::UserAgent, the file may be large, instead of passing the file contents as scalar, is there any other way?
This is what I have tried:
use strict;
use warnings;
use Mojo::UserAgent;
use…

Pradeep
- 3,093
- 17
- 21
5
votes
2 answers
Using Mojo::UserAgent and accessing the JSON in response?
How can I get access to JSON in a mojo response?
$txn = $ua->post( $url, $headers, json => {json} )
What's the way to get the JSON response from the txn?

Evan Carroll
- 78,363
- 46
- 261
- 468
5
votes
1 answer
How should I process HTML META tags with Mojo::UserAgent?
I have to play with some misconfigured web servers, so I started processing the HTML meta tags to feed information back into the web user-agent object. I tried a variety of ways of doing this in Mojolicious and settled on a looking for a "finish"…

brian d foy
- 129,424
- 31
- 207
- 592
4
votes
1 answer
How to assign promise returned from get_p to a variable?
I tried to return a promise from a subroutine which contained some data obtained from a HTTP request to a web server. But I couldn't call then on the result. Having narrowed it down, it doesn't seem possible to assign the promise returned from get_p…

Geraint Anderson
- 3,234
- 4
- 28
- 49
4
votes
1 answer
How to user Mojo::UserAgent's connect_timeout
Perl newbie here. I have a line of code:
my $api_data = decode_json( $ua->get($url)->res->body );
where $ua = Mojo::UserAgent->new. On occasion, the request may hang (indefinitely) and I'd like to specify a connection timeout.
The documentation…

skippr
- 2,656
- 3
- 24
- 39
3
votes
1 answer
Mojo::UserAgent (Mojo command line ) and insecure modifier
I have the following Mojo::UserAgent code which works fine :
$ua->insecure(1)->get('https://someurl')
trying to do this with Mojo command line
mojo get -v https://someurl
I am getting this error
SSL connect attempt failed error:1416F086:SSL…

dave
- 867
- 1
- 5
- 11
2
votes
1 answer
cloudflare protection is blocking the website connectivity in mojo::user-agent - perl
I just want to validate the website link whether it is connecting or not. I added the website also in the code. Please show some light on this.
Here is my code:
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my $timeout =…

Rajeshkanna Purushothaman
- 750
- 5
- 11
2
votes
1 answer
Matching methods from LWP::UserAgent to Mojo::UserAgent
I need to convert LWP::UserAgent to Mojo::UserAgent to support async calls. Problem is I couldn't find the exact methods that matches the LWP::UserAgent methods below, for example, how do I convert the following LWP methods over to Mojo's? Any…

santa100
- 255
- 1
- 5
2
votes
0 answers
submitting form with Mojo::UserAgent
I want to submit a form using Mojo::UserAgent where the form has the following:

jsor
- 637
- 4
- 10
2
votes
0 answers
Unable to post messages using Mailbox API and Mojo::UserAgent
According to the API docs (https://documentation.mailgun.com/api-sending.html) all the relevant parameters are supplied, but it gives me
400 response: BAD REQUEST
Here's my piece of code:
#!/usr/bin/perl
use Mojo::UserAgent;
use MIME::Base64;
use…

varnie
- 2,523
- 3
- 35
- 42
2
votes
3 answers
How to send arbitrary payload with Mojo::UserAgent?
I'm trying to use Mojo::UserAgent to access the eBay API.
One of the options is to use API requests with an XML payload, but I have had no success doing it with Mojo::UserAgent. I didn't find any options for the $ua->post method.
I also tried
my $tx…

Nikita Tropin
- 43
- 4
1
vote
1 answer
mojo::useragent and Get Request Parameters
Let's Say I have this Mojo::UserAgent get request :
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
print $ua->get('https://google.com?q=mojolicious&format=json');
on the above example the get parameters provided as part of the url itself , I…

dave
- 867
- 1
- 5
- 11
1
vote
1 answer
Mojo::DOM breaking UTF8 in Perl
I'm trying to find out how to use Mojo::DOM with UTF8 (and other formats... not just UTF8). It seems to mess up the encoding:
my $dom = Mojo::DOM->new($html);
$dom->find('script')->reverse->each(sub {
#print "$_->{id}\n";
…

Andrew Newby
- 4,941
- 6
- 40
- 81