File Coverage

blib/lib/Plack/ResponseHelper/JSON.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             package Plack::ResponseHelper::JSON;
2 1     1   6 use strict;
  1         10  
  1         39  
3 1     1   6 use warnings;
  1         1  
  1         25  
4              
5 1     1   1231 use JSON;
  1         21520  
  1         6  
6 1     1   1063 use Plack::Response;
  1         23087  
  1         130  
7              
8             sub helper {
9             return sub {
10 1     1   2 my $r = shift;
11 1         42 my $body = encode_json $r;
12 1         11 my $response = Plack::Response->new(200);
13 1         33 $response->content_type('application/json; charset=utf-8');
14 1         41 $response->body($body);
15 1         9 return $response;
16 1     1 0 8 };
17             }
18              
19             1;
20              
21             __END__