lib/soaspec/rest_handler.rb in soaspec-0.0.27 vs lib/soaspec/rest_handler.rb in soaspec-0.0.28
- old
+ new
@@ -63,15 +63,17 @@
@test_values = request_parameters
self
end
# Used in together with Exchange request that passes such override parameters
+ # @param [Hash] override_parameters Params to characterize REST request
def make_request(override_parameters)
test_values = override_parameters
test_values[:params] ||= {}
test_values[:suburl] = test_values[:suburl].to_s if test_values[:suburl]
+ begin
response = case test_values[:method]
when :post
if test_values[:suburl]
@resource[test_values[:suburl]].send(test_values[:method].to_s, test_values[:payload], test_values[:params])
else
@@ -82,15 +84,22 @@
@resource[test_values[:suburl]].send(test_values[:method].to_s, test_values[:params])
else
@resource.send(test_values[:method].to_s, test_values[:params])
end
end
+ rescue RestClient::ExceptionWithResponse => e
+ response = e.response
+ end
Soaspec::SpecLogger.add_to(response)
response
end
def include_in_body?(response, expected)
response.body.include? expected
+ end
+
+ def found?(response)
+ response.code != 404
end
# Convert XML or JSON response into a Hash
# @param [String] response Response as a String (either in XML or JSON)
# @return [Hash]
\ No newline at end of file