Sha256: 72a9e60a1e0267e6dc999878816ef27e32dbb909da0bcf70ed0e8b2a3d0b4bbc

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

require 'uri'

module Twimock
  module OmniAuth
    module Strategies
      module Twitter
        def request_phase
          status, header, body = __request_phase
          location = URI.parse(header["Location"])

          if status == 302 && location.host == "api.twitter.com"
            location.host   = Twimock::Config.host
            case Twimock::Config.port
            when 443 then location.scheme = "https"
            when 80  then location.scheme = "http"
            else
              location.scheme = "http"
              location.port   = Twimock::Config.port
            end
            header["Location"] = location.to_s
          end

          [ status, header, body ]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twimock-0.0.2 lib/twimock/omniauth/strategies/twitter.rb
twimock-0.0.1 lib/twimock/omniauth/strategies/twitter.rb