Sha256: 7b5712cc38ec86c58e700ec7cfb060ae1a1298a5e453fc0d1d51c1502b834e16

Contents?: true

Size: 1000 Bytes

Versions: 14

Compression:

Stored size: 1000 Bytes

Contents

# frozen_string_literal: true

require "oauth/request_proxy/base"
require "uri"
require "rack"

module OAuth
  module RequestProxy
    class RackRequest < OAuth::RequestProxy::Base
      proxies ::Rack::Request

      def method
        request.env["rack.methodoverride.original_method"] || request.request_method
      end

      def uri
        request.url
      end

      def parameters
        if options[:clobber_request]
          options[:parameters] || {}
        else
          params = request_params.merge(query_params).merge(header_params)
          params.merge(options[:parameters] || {})
        end
      end

      def signature
        parameters["oauth_signature"]
      end

      protected

      def query_params
        request.GET
      end

      def request_params
        if request.content_type && request.content_type.to_s.downcase.start_with?("application/x-www-form-urlencoded")
          request.POST
        else
          {}
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
oauth-1.1.0 lib/oauth/request_proxy/rack_request.rb
oauth-1.0.1 lib/oauth/request_proxy/rack_request.rb
oauth-0.6.2 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.14 lib/oauth/request_proxy/rack_request.rb
oauth-1.0.0 lib/oauth/request_proxy/rack_request.rb
oauth-0.6.1 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.13 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.12 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.11 lib/oauth/request_proxy/rack_request.rb
oauth-0.6.0 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.10 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.9 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.8 lib/oauth/request_proxy/rack_request.rb
oauth-0.5.7 lib/oauth/request_proxy/rack_request.rb