lib/rapidash/http_client.rb in rapidash-0.0.5 vs lib/rapidash/http_client.rb in rapidash-0.0.6
- old
+ new
@@ -31,9 +31,13 @@
url = connection.build_url(url, options[:params]).to_s
response = connection.run_request(verb, url, options[:body], options[:header])
# "foo"[0] does not work in 1.8.7, "foo"[0,1] is required
case response.status.to_s[0,1]
+ when "5", "4"
+ error = ResponseError.new(response)
+ raise error if self.class.respond_to?(:raise_error) && self.class.raise_error
+ return nil
#Handle redirects
when "3"
request(verb, response.headers["location"], options)
when "2"
return Response.new(response)