bin/check-http.rb in sensu-plugins-http-2.2.0 vs bin/check-http.rb in sensu-plugins-http-2.3.0
- old
+ new
@@ -26,10 +26,15 @@
# check-http.rb -u https://my.site.com/redirect --response-code 301 -r
#
# Use a proxy to check a URL
# check-http.rb -u https://www.google.com --proxy-url http://my.proxy.com:3128
#
+# Check something with needing to set multiple headers
+# check-http.rb -u https://www.google.com --header 'Origin: ma.local.box, SomeRandomHeader: foo'
+#
+# Check something that requires a POST with json data
+# check-http.rb -u https://httpbin.org/post --method POST --header 'Content-type: application/json' --body '{"foo": "bar"}'
# NOTES:
#
# LICENSE:
# Copyright 2011 Sonian, Inc <chefs@sonian.net>
# Updated by Lewis Preson 2012 to accept basic auth credentials
@@ -75,13 +80,13 @@
long: '--request-uri PATH',
description: 'Specify a uri path'
option :method,
short: '-m GET|POST',
- long: '--method GET|POST',
- description: 'Specify a GET or POST operation; defaults to GET',
- in: %w(GET POST),
+ long: '--method GET|POST|PUT',
+ description: 'Specify a GET, POST, or PUT operation; defaults to GET',
+ in: %w(GET POST PUT),
default: 'GET'
option :header,
short: '-H HEADER',
long: '--header HEADER',
@@ -269,9 +274,11 @@
req = case config[:method]
when 'GET'
Net::HTTP::Get.new(config[:request_uri], 'User-Agent' => config[:ua])
when 'POST'
Net::HTTP::Post.new(config[:request_uri], 'User-Agent' => config[:ua])
+ when 'PUT'
+ Net::HTTP::Put.new(config[:request_uri], 'User-Agent' => config[:ua])
end
unless config[:user].nil? && config[:password].nil?
req.basic_auth config[:user], config[:password]
end