App-MFILE-WWW
view release on metacpan or search on metacpan
lib/App/MFILE/WWW/Resource.pm view on Meta::CPAN
sub known_content_type {
my ( $self, $content_type ) = @_;
#$log->debug( "known_content_type: " . Dumper $content_type );
# for GET requests, we don't care about the content
return 1 if $self->request->method eq 'GET';
# some requests may not specify a Content-Type at all
return 0 if not defined $content_type;
# unfortunately, Web::Machine sometimes sends the content-type
# as a plain string, and other times as an
# HTTP::Headers::ActionPack::MediaType object
if ( ref( $content_type ) eq '' ) {
return ( $content_type =~ m/application\/json/ ) ? 1 : 0;
}
if ( ref( $content_type ) eq 'HTTP::Headers::ActionPack::MediaType' ) {
$log->debug( "Content type is a HTTP::Headers::ActionPack::MediaType object!" );
return $content_type->match( 'application/json' ) ? 1 : 0;
}
return 0;
( run in 1.418 second using v1.01-cache-2.11-cpan-524268b4103 )