summaryrefslogtreecommitdiff
path: root/lib/chef/rest.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/rest.rb')
-rw-r--r--lib/chef/rest.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb
index b264f96336..1a60fa093e 100644
--- a/lib/chef/rest.rb
+++ b/lib/chef/rest.rb
@@ -29,7 +29,8 @@ end
require 'chef/http/authenticator'
require 'chef/http/decompressor'
-require 'chef/http/json_to_model_inflater'
+require 'chef/http/json_input'
+require 'chef/http/json_to_model_output'
require 'chef/http/cookie_manager'
require 'chef/config'
require 'chef/exceptions'
@@ -58,10 +59,14 @@ class Chef
options[:signing_key_filename] = signing_key_filename
super(url, options)
- @chef_json_inflater = JSONToModelInflater.new(options)
- @cookie_manager = CookieManager.new(options)
@decompressor = Decompressor.new(options)
@authenticator = Authenticator.new(options)
+
+ @middlewares << JSONInput.new(options)
+ @middlewares << JSONToModelOutput.new(options)
+ @middlewares << CookieManager.new(options)
+ @middlewares << @decompressor
+ @middlewares << @authenticator
end
def signing_key_filename
@@ -94,9 +99,9 @@ class Chef
# to JSON inflated.
def get(path, raw=false, headers={})
if raw
- streaming_request(create_url(path), headers)
+ streaming_request(path, headers)
else
- api_request(:GET, create_url(path), headers)
+ request(:GET, path, headers)
end
end
@@ -117,11 +122,6 @@ class Chef
streaming_request(create_url(path), headers) {|tmp_file| yield tmp_file }
end
- # Chef::REST doesn't define middleware in the normal way for backcompat reasons, so it's hardcoded here.
- def middlewares
- [@chef_json_inflater, @cookie_manager, @decompressor, @authenticator]
- end
-
alias :api_request :request
alias :raw_http_request :send_http_request