lib/flexirest/request.rb in flexirest-1.4.2 vs lib/flexirest/request.rb in flexirest-1.4.3
- old
+ new
@@ -486,10 +486,18 @@
raise HTTPUnauthorisedClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
elsif status == 403
raise HTTPForbiddenClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
elsif status == 404
raise HTTPNotFoundClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
+ elsif status == 405
+ raise HTTPMethodNotAllowedClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
+ elsif status == 406
+ raise HTTPNotAcceptableClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
+ elsif status == 408
+ raise HTTPTimeoutClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
+ elsif status == 409
+ raise HTTPConflictClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
elsif (400..499).include? status
raise HTTPClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
elsif (500..599).include? status
raise HTTPServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
elsif status == 0
@@ -710,9 +718,13 @@
end
class HTTPClientException < HTTPException ; end
class HTTPUnauthorisedClientException < HTTPClientException ; end
class HTTPBadRequestClientException < HTTPClientException ; end
class HTTPForbiddenClientException < HTTPClientException ; end
+ class HTTPMethodNotAllowedClientException < HTTPClientException ; end
+ class HTTPNotAcceptableClientException < HTTPClientException ; end
+ class HTTPTimeoutClientException < HTTPClientException ; end
+ class HTTPConflictClientException < HTTPClientException ; end
class HTTPNotFoundClientException < HTTPClientException ; end
class HTTPServerException < HTTPException ; end
end