File Coverage

blib/lib/HTTP/Message/JSON.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package HTTP::Message::JSON;
2              
3 5     5   1645 use strict;
  5         11  
  5         130  
4 5     5   29 use warnings;
  5         11  
  5         143  
5 5     5   27 no warnings 'uninitialized';
  5         13  
  5         474  
6              
7             our $VERSION = $LWP::JSON::Tiny::VERSION;
8              
9             =head1 NAME
10              
11             HTTP::Message::JSON - a very simple superclass for JSON HTTP messages
12              
13             =head1 DESCRIPTION
14              
15             This is a very simple superclass used by HTTP::Request::JSON and
16             HTTP::Response::JSON. It overrides the default behaviour of the HTTP::Headers
17             method content_is_text.
18              
19             =head2 content_is_text
20              
21             Returns TRUE if this is a message with content type application/json.
22             Otherwise uses the default behaviour of HTTP::Headers.
23              
24             =cut
25              
26             sub content_is_text {
27 94     94 1 24925 my ($self) = @_;
28              
29 94 100       228 if ($self->content_type eq 'application/json') {
30 89         2270 return 1;
31             } else {
32 5         135 return HTTP::Headers::content_is_text($self);
33             }
34             }
35              
36             1;