TraitFor/Request/ExtJS.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
is_ext_upload
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #
2 # This file is part of CatalystX-ExtJS-Direct
3 #
4 # This software is Copyright (c) 2014 by Moritz Onken.
5 #
6 # This is free software, licensed under:
7 #
8 # The (three-clause) BSD License
9 #
10 package CatalystX::TraitFor::Request::ExtJS;
11 $CatalystX::TraitFor::Request::ExtJS::VERSION = '2.1.5';
12 # ABSTRACT: Sets the request method via a query parameter
13 use Moose::Role;
14  
15 use namespace::autoclean;
16 use JSON::XS;
17  
18 #has 'is_ext_upload' => ( isa => 'Bool', is => 'rw', lazy_build => 1 );
19  
20 sub is_ext_upload {
21 my ($self) = @_;
22 return $self->header('Content-Type')
23 && $self->header('Content-Type') =~ /^multipart\/form-data/
24 && ( !$self->{content_type} || $self->{content_type} ne 'application/json');
25 }
26  
27 around 'method' => sub {
28 my ( $orig, $self, $method ) = @_;
29 return $self->$orig($method) if($method);
30 return $self->query_params->{'x-tunneled-method'} || $self->$orig();
31
32  
33 };
34  
35 1;
36  
37 __END__