ACME2/HTTP/Response.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 32 CC 1 SCAR 6.9
CC
1
Cov
0%
die_because_unexpected
2.0
content_struct
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::ACME2::HTTP::Response;
2  
3 use strict;
4 use warnings;
5  
6 use parent qw( HTTP::Tiny::UA::Response );
7  
8 use JSON ();
9  
10 use Net::ACME2::X ();
11  
12 sub die_because_unexpected {
13 my ($self) = @_;
14  
15 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 my ($self) = @_;
29  
30 my $json = ($self->{'_json'} ||= JSON->new()->allow_nonref());
31  
32 return $json->decode( $self->content() );
33 }
34  
35 1;