File Coverage

blib/lib/Net/ACME2/HTTP/Response.pm
Criterion Covered Total %
statement 18 20 90.0
branch n/a
condition 1 3 33.3
subroutine 6 7 85.7
pod 0 2 0.0
total 25 32 78.1


line stmt bran cond sub pod time code
1             package Net::ACME2::HTTP::Response;
2              
3 2     2   14 use strict;
  2         4  
  2         56  
4 2     2   13 use warnings;
  2         9  
  2         71  
5              
6 2     2   12 use parent qw( HTTP::Tiny::UA::Response );
  2         6  
  2         12  
7              
8 2     2   164 use JSON ();
  2         6  
  2         38  
9              
10 2     2   10 use Net::ACME2::X ();
  2         4  
  2         298  
11              
12             sub die_because_unexpected {
13 0     0 0 0 my ($self) = @_;
14              
15 0         0 die Net::ACME2::X->create(
16             'UnexpectedResponse',
17             {
18             uri => $self->url(),
19             status => $self->status(),
20             reason => $self->reason(),
21             headers => $self->headers(),
22             },
23             );
24             }
25              
26             #Useful for everything but certificate issuance, apparently?
27             sub content_struct {
28 12     12 0 488 my ($self) = @_;
29              
30 12   33     170 my $json = ($self->{'_json'} ||= JSON->new()->allow_nonref());
31              
32 12         218 return $json->decode( $self->content() );
33             }
34              
35             1;