diff options
author | jamesc <james@opscode.com> | 2013-11-17 18:36:37 -0800 |
---|---|---|
committer | jamesc <james@opscode.com> | 2013-11-17 18:36:37 -0800 |
commit | 25b383f580fa2086c639369b8ee40d3db1fff337 (patch) | |
tree | c6738595457fabeda3f2312c3429061e38c60731 /lib/chef | |
parent | ecbc917ac5496f3138b798332ea66f477c33f8ba (diff) | |
download | chef-25b383f580fa2086c639369b8ee40d3db1fff337.tar.gz |
raw_http_request was aliased to send_http_request, which is below the
level of the middleware being applied.
This patch makes raw_http_request behave like request, except the only
middleware that is applied is the AuthN for talking to the chef server
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/rest.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb index d8c2a005d7..721c396a61 100644 --- a/lib/chef/rest.rb +++ b/lib/chef/rest.rb @@ -124,9 +124,21 @@ class Chef alias :api_request :request - alias :raw_http_request :send_http_request - - public :raw_http_request + def raw_http_request(method, path, headers, data) + url = create_url(path) + method, url, headers, data = @authenticator.handle_request(method, url, headers, data) + + response, rest_request, return_value = send_http_request(method, url, headers, data) + response.error! unless success_response?(response) + return_value + rescue Exception => exception + log_failed_request(response, return_value) unless response.nil? + + if exception.respond_to?(:chef_rest_request=) + exception.chef_rest_request = rest_request + end + raise + end # Deprecated: # Responsibilities of this method have been split up. The #http_client is |