From 448bda869ce68cdcfe4bdf2414b84c1e0a30949b Mon Sep 17 00:00:00 2001 From: Florian Schwab Date: Tue, 7 May 2019 11:48:22 +0200 Subject: [PATCH] allow to specify --response-code for 3xx codes without specifying -r or --redirect-to --- CHANGELOG.md | 2 ++ bin/check-http.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14861d5..1a7f903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md) ## [Unreleased] +### Changed +check-http.rb: Allow to specify `--response-code` for 3xx codes without having to specify `-r` or `--redirect-to` explicitly ## [5.1.0] - 2019-05-06 ### Added diff --git a/bin/check-http.rb b/bin/check-http.rb index b63abcb..c4477da 100755 --- a/bin/check-http.rb +++ b/bin/check-http.rb @@ -428,7 +428,7 @@ def handle_response(res, size, body) critical "Expected redirect to #{config[:redirectto]} instead redirected to #{res['Location']}" + body end end - else + elsif !config[:response_code] warning res.code + body end when /^4/, /^5/