blib/lib/WebService/Mattermost/Util/UserAgent.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 14 | 14 | 100.0 |
branch | n/a | ||
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | n/a | ||
total | 18 | 18 | 100.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package WebService::Mattermost::Util::UserAgent; 2: 3: # ABSTRACT: Internal user agent. 4: 5: use Moo; 6: use Mojo::UserAgent; 7: use Types::Standard qw(Bool InstanceOf Int); 8: 9: ################################################################################ 10: 11: has ua => (is => 'ro', isa => InstanceOf['Mojo::UserAgent'], lazy => 1, builder => 1); 12: 13: has inactivity_timeout => (is => 'ro', isa => Int, default => 15); 14: has max_redirects => (is => 'ro', isa => Int, default => 5); 15: 16: ################################################################################ 17: 18: sub _build_ua { 19: my $self = shift; 20: 21: my $ua = Mojo::UserAgent->new(); 22: 23: $ua->max_redirects($self->max_redirects); 24: $ua->inactivity_timeout($self->inactivity_timeout); 25: 26: return $ua; 27: } 28: 29: ################################################################################ 30: 31: 1; 32: 33: __END__ 34: 35: =pod 36: 37: =encoding UTF-8 38: 39: =head1 NAME 40: 41: WebService::Mattermost::Util::UserAgent - Internal user agent. 42: 43: =head1 VERSION 44: 45: version 0.28 46: 47: =head1 DESCRIPTION 48: 49: Adds standard parameters to C<Mojo::UserAgent>. 50: 51: =head2 ATTRIBUTES 52: 53: =over 4 54: 55: =item C<ua> 56: 57: A C<Mojo::Log> object. 58: 59: =item C<inactivity_timeout()> 60: 61: The default inactivity timeout (15 seconds). 62: 63: =item C<max_redirects()> 64: 65: The default maximum number of redirects (5). 66: 67: =back 68: 69: =head1 AUTHOR 70: 71: Mike Jones <mike@netsplit.org.uk> 72: 73: =head1 COPYRIGHT AND LICENSE 74: 75: This software is Copyright (c) 2020 by Mike Jones. 76: 77: This is free software, licensed under: 78: 79: The MIT (X11) License 80: 81: =cut 82: |