Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #115 from flomotlik/check-response-code

Adding -r argument to executable to fail if response code >= 400
  • Loading branch information...
commit 1cff3412b36c1555f8db68414b2370d9416e226b 2 parents 2a38c72 + d0a88d7
@jnunemaker authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 bin/httparty
View
5 bin/httparty
@@ -54,6 +54,10 @@ OptionParser.new do |o|
opts[:basic_auth] = { :username => user, :password => password }
end
+ o.on("-r", "--response-code", "Command fails if response code >= 400") do
+ opts[:response_code] = true
+ end
+
o.on("-h", "--help", "Show help documentation") do |h|
puts o
exit
@@ -106,3 +110,4 @@ else
puts response
end
end
+exit false if opts[:response_code] && response.code >= 400
Please sign in to comment.
Something went wrong with that request. Please try again.