diff options
Diffstat (limited to 'lib/chef_zero/rest_base.rb')
-rw-r--r-- | lib/chef_zero/rest_base.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb index 74ca014..e6114c4 100644 --- a/lib/chef_zero/rest_base.rb +++ b/lib/chef_zero/rest_base.rb @@ -46,8 +46,8 @@ module ChefZero return response unless response.nil? method = request.method.downcase.to_sym - if !self.respond_to?(method) - accept_methods = [:get, :put, :post, :delete].select { |m| self.respond_to?(m) } + if !respond_to?(method) + accept_methods = [:get, :put, :post, :delete].select { |m| respond_to?(m) } accept_methods_str = accept_methods.map { |m| m.to_s.upcase }.join(", ") return [405, { "Content-Type" => "text/plain", "Allow" => accept_methods_str }, "Bad request method for '#{request.env['REQUEST_PATH']}': #{request.env['REQUEST_METHOD']}"] end @@ -56,7 +56,7 @@ module ChefZero end # Dispatch to get()/post()/put()/delete() begin - self.send(method, request) + send(method, request) rescue RestErrorResponse => e ChefZero::Log.debug("#{e.inspect}\n#{e.backtrace.join("\n")}") error(e.response_code, e.error) @@ -72,7 +72,7 @@ module ChefZero # This parses as per http://tools.ietf.org/html/rfc7231#section-5.3 return true if !request.env["HTTP_ACCEPT"] accepts = request.env["HTTP_ACCEPT"].split(/,\s*/).map { |x| x.split(";", 2)[0].strip } - return accepts.include?("#{category}/#{type}") || accepts.include?("#{category}/*") || accepts.include?("*/*") + accepts.include?("#{category}/#{type}") || accepts.include?("#{category}/*") || accepts.include?("*/*") end def get_data(request, rest_path = nil, *options) |