From: Michal Fojtik <[email protected]> Previously the 40x HTTP response status was dropped and replaced by 'default' description from HTTP specification. This patch will allow to send user-defined messages from server. For example code 400 (Bad request) can now indicate invalid parameters to the client.
Signed-off-by: Michal fojtik <[email protected]> --- client/lib/deltacloud.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb index e0cb2e4..e6ae89e 100644 --- a/client/lib/deltacloud.rb +++ b/client/lib/deltacloud.rb @@ -355,10 +355,10 @@ module DeltaCloud end def response_error(response) - if response.code.to_s =~ /4(\d{2})/ + xml = Nokogiri::XML(response.to_s) + if (xml/'message').empty? and response.code.to_s =~ /4(\d{2})/ DeltaCloud::HTTPError.client_error(response.code) else - xml = Nokogiri::XML(response.to_s) opts = { :driver => (xml/'backend').first[:driver], :provider => (xml/'backend').first[:provider], -- 1.7.9.1
