File Coverage

blib/lib/JMAP/Tester/Logger/HTTP.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 39 39 100.0


line stmt bran cond sub pod time code
1 2     2   135944 use v5.14.0;
  2         6  
2             package JMAP::Tester::Logger::HTTP 0.110;
3              
4 2     2   9 use Moo;
  2         3  
  2         12  
5              
6 2     2   677 use namespace::clean;
  2         2  
  2         13  
7              
8 2     2   815 use experimental 'signatures';
  2         1185  
  2         11  
9              
10             my %counter;
11              
12 4     4   5 sub _log_generic ($self, $tester, $type, $thing) {
  4         4  
  4         5  
  4         5  
  4         4  
  4         5  
13 4         21 my $i = $counter{$type}++;
14 4         12 my $ident = $tester->ident;
15 4         45 $self->write("=== BEGIN \U$type\E $$.$i ($ident) ===\n");
16 4         23 $self->write( $thing->as_string );
17 4         31 $self->write("=== END \U$type\E $$.$i ($ident) ===\n");
18 4         12 return;
19             }
20              
21             for my $which (qw(jmap misc upload download)) {
22             for my $what (qw(request response)) {
23             my $method = "log_${which}_${what}";
24 2     2   686 no strict 'refs';
  2         3  
  2         286  
25 4     4   7 *$method = sub ($self, $tester, $arg) {
  4         5  
  4         3  
  4         4  
  4         4  
26 4         16 $self->_log_generic($tester, "$which $what", $arg->{"http_$what"});
27             }
28             }
29             }
30              
31             with 'JMAP::Tester::Logger';
32              
33             1;
34              
35             __END__