Adds support for Content-Type of application/json; charset=utf-8 in addition to application/json

This commit is contained in:
James Becwar 2013-01-17 17:36:13 +00:00
parent ba46e4938e
commit 88025f0dc1

View File

@ -7,7 +7,7 @@ use LWP::UserAgent;
use JSON 'decode_json';
my $plugin_name = "Nagios check_http_json";
my $VERSION = "1.00";
my $VERSION = "1.01";
# getopt module config
$Getopt::Std::STANDARD_HELP_VERSION = 1;
@ -40,7 +40,7 @@ $ua->timeout($opts{t});
my $response = $ua->get($opts{U});
if ( $response->header("content-type") ne 'application/json' )
if ( index($response->header("content-type"), 'application/json') == -1 )
{
print "Expected content-type to be application/json, got ", $response->header("content-type");
exit EXIT_CRITICAL;