From 88025f0dc1e58777b678dde132be6a77a8012a05 Mon Sep 17 00:00:00 2001 From: James Becwar Date: Thu, 17 Jan 2013 17:36:13 +0000 Subject: [PATCH] Adds support for Content-Type of application/json; charset=utf-8 in addition to application/json --- check_json.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_json.pl b/check_json.pl index df84ec9..70a5ed4 100755 --- a/check_json.pl +++ b/check_json.pl @@ -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;