Hi all,
Does Mojo::UA offer a control to cancel an in-flight HTTP request? I
don’t see one in the docs but wonder if I’m just missing it.
(The promise, of course, can be pre-resolved/rejected, but that doesn’t
appear to affect the underlying HTTP request.)
Thank you!
c
https://metacpan.org/pod/Mojo::Transaction#completed
On Fri, 23 Oct 2020 at 17:07, Felipe Gasper wrote:
>
> Hi all,
>
> Does Mojo::UA offer a control to cancel an in-flight HTTP request? I
> don’t see one in the docs but wonder if I’m just missing it.
>
> (The promise, of course,
Thank you!
When I try:
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my $p = $ua->get_p('http://www.google.com');
Mojo::Promise->timer(0.01)->then( sub { print "canceling\n"; $p->completed() }
);
Mojo::Promise->timer(2)->wait();
… then strace that script, the request continu
You can set a response error on the transaction to cancel it safely. That's
what the Mojolicious tests use.
--
sebastian
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an e
> my $p = $ua->get_p('http://www.google.com');
>
https://metacpan.org/pod/Mojo::UserAgent#get_p returns a Mojo::Promise object
> Mojo::Promise->timer(0.01)->then( sub { print "canceling\n"; $p->completed()
> } );
>
https://metacpan.org/pod/Mojo::Promise doesn't have `completed` method
your are ca
> On Oct 23, 2020, at 10:42 AM, Dmitry L. wrote:
>
>> my $p = $ua->get_p('http://www.google.com');
>>
> https://metacpan.org/pod/Mojo::UserAgent#get_p returns a Mojo::Promise object
>
>> Mojo::Promise->timer(0.01)->then( sub { print "canceling\n"; $p->completed()
>> } );
>>
> https://metacp
> On Oct 23, 2020, at 10:42 AM, Dmitry L. wrote:
>
>> my $p = $ua->get_p('http://www.google.com');
>>
> https://metacpan.org/pod/Mojo::UserAgent#get_p returns a Mojo::Promise object
>
>> Mojo::Promise->timer(0.01)->then( sub { print "canceling\n"; $p->completed()
>> } );
>>
> https://metacp