summaryrefslogtreecommitdiff
path: root/lib/chef/rest.rb
diff options
context:
space:
mode:
authorjamesc <james@opscode.com>2013-11-17 18:36:37 -0800
committerjamesc <james@opscode.com>2013-11-17 18:36:37 -0800
commit25b383f580fa2086c639369b8ee40d3db1fff337 (patch)
treec6738595457fabeda3f2312c3429061e38c60731 /lib/chef/rest.rb
parentecbc917ac5496f3138b798332ea66f477c33f8ba (diff)
downloadchef-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/rest.rb')
-rw-r--r--lib/chef/rest.rb18
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