Sha256: 80bcdc1840d71411ad21a46c7b32349dec863df4b6ef6c4860c61fe8aa577991

Contents?: true

Size: 712 Bytes

Versions: 8

Compression:

Stored size: 712 Bytes

Contents

class ExvoAuth::Dejavu
  def initialize(app)
    @app = app
  end
  
  def call(env)
    dejavu(env) if Rack::Request.new(env).path == "/auth/dejavu"
    @app.call(env)
  end
  
  private
  
  def dejavu(env)
    params = Rack::Request.new(env).params
    dejavu = params.delete("_dejavu")

    env["QUERY_STRING"]   = Rack::Utils.build_nested_query(params) # Will not work with file uploads.
    env["SCRIPT_NAME"]    = dejavu["script_name"]  # for Rack::Request
    env["PATH_INFO"]      = dejavu["path_info"]    # for Rack::Request
    env["REQUEST_PATH"]   = dejavu["request_path"] # for Merb::Request
    env["REQUEST_METHOD"] = dejavu["method"]
    env["CONTENT_TYPE"]   = dejavu["content_type"]
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
exvo_auth-0.15.1 lib/exvo_auth/dejavu.rb
exvo_auth-0.15.0 lib/exvo_auth/dejavu.rb
exvo-auth-0.14.1 lib/exvo_auth/dejavu.rb
exvo-auth-0.14.0 lib/exvo_auth/dejavu.rb
exvo-auth-0.13.0 lib/exvo_auth/dejavu.rb
exvo-auth-0.12.2 lib/exvo_auth/dejavu.rb
exvo-auth-0.12.1 lib/exvo_auth/dejavu.rb
exvo-auth-0.12.0 lib/exvo_auth/dejavu.rb