NAME

Mojo::Transaction::HTTP::Role::Retry - Adds a retries attribute

VERSION

version 0.001

SYNOPSIS

use Mojo::Base -signatures;

{
  use Mojolicious::Lite;
  my $ok = 0;
  get '/' => sub ($c) {
    return $ok++ ?
      $c->render(text => 'OK!') :
      $c->render(text => 'Not OK!', status => 429);
  };
}

my $ua = Mojo::UserAgent->with_roles('+Retry')->new;
$ua->get(
  '/' => sub ($ua, $tx) {
    say $tx->retries; # 1
    Mojo::IOLoop->stop;
  }
);
Mojo::IOLoop->start;

DESCRIPTION

This role adds a retries attribute to Mojo::Transaction::HTTP.

ATTRIBUTES

retries

The number of retries that have been attempted.

SEE ALSO

Mojo::UserAgent::Role::Retry.

AUTHOR

Christian Segundo <ssmn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Christian Segundo <ssmn@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.