module Fog::OpenStack::Common
Attributes
unscoped_token[R]
Public Instance Methods
request(params)
click to toggle source
# File lib/fog/openstack/common.rb, line 8 def request(params) retried = false begin std_headers = { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token } param_headers = params.fetch(:headers, {}) response = @connection.request(params.merge({ :headers => std_headers.merge(param_headers), :path => "#{@path}/#{params[:path]}" })) rescue Excon::Errors::Unauthorized => error raise if retried retried = true @openstack_must_reauthenticate = true authenticate retry rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound self.class.not_found_class.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) unless params[:raw_body] end response end