Sha256: 68c936980e96d82a8f659194d5e6693c3bc77767c457aea85f453a1d62d23c73

Contents?: true

Size: 878 Bytes

Versions: 6

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

require "action_controller"
require "action_controller/test_process"

module OAuth
  module OAuthTestHelper
    def mock_incoming_request_with_query(request)
      incoming = ActionController::TestRequest.new(request.to_hash)
      incoming.request_uri = request.path
      incoming.host = request.uri.host
      incoming.env["SERVER_PORT"] = request.uri.port
      incoming.env["REQUEST_METHOD"] = request.http_method
      incoming
    end

    def mock_incoming_request_with_authorize_header(request)
      incoming = ActionController::TestRequest.new
      incoming.request_uri = request.path
      incoming.host = request.uri.host
      incoming.env["HTTP_AUTHORIZATION"] = request.to_auth_string
      incoming.env["SERVER_PORT"] = request.uri.port
      incoming.env["REQUEST_METHOD"] = request.http_method
      incoming
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
oauth-1.1.0 lib/oauth/oauth_test_helper.rb
oauth-1.0.1 lib/oauth/oauth_test_helper.rb
oauth-0.6.2 lib/oauth/oauth_test_helper.rb
oauth-1.0.0 lib/oauth/oauth_test_helper.rb
oauth-0.6.1 lib/oauth/oauth_test_helper.rb
oauth-0.6.0 lib/oauth/oauth_test_helper.rb