# File lib/aeolus_image/model/warehouse/warehouse_client.rb, line 139
        def do_request(path = '/', opts={})
          opts[:method]  ||= :get
          opts[:content] ||= ''
          opts[:plain]   ||= false
          opts[:headers] ||= {}

          # Using restclient seems to break OAuth POSTs, so use the oauth gem directly if we're using OAuth:
          if @token
            # TODO - I'm not sure how to pass :headers through here, but we don't actually use them anywhere
            response = @token.request(opts[:method], (@uri + path).to_s, opts[:content].to_s)
            # Errors don't cause exceptions like they do with RestClient, so detect and raise them:
            if response.is_a?(Net::HTTPSuccess)
              result = response.body
            # Translate a few common errors to their RestClient counterparts that we're used to checking for:
            elsif response.is_a?(Net::HTTPNotFound)
              raise RestClient::ResourceNotFound
            elsif response.is_a?(Net::HTTPInternalServerError)
              raise RestClient::InternalServerError
            # Otherwise, raise the error:
            else
              response.error!
            end
          else # no @token -- use RestClient
            result = RestClient::Request.execute(:method => opts[:method], :url => @uri + path, :payload => opts[:content], :headers => opts[:headers])
          end
          return opts[:plain] ? result : Nokogiri::XML(result)
        end