Sha256: 330439720b681cebbfd6a84a549bf94342f4350e1e95c4d39a42a97fc441881e

Contents?: true

Size: 715 Bytes

Versions: 13

Compression:

Stored size: 715 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

13 entries across 13 versions & 1 rubygems

Version Path
exvo-auth-0.11.2 lib/exvo_auth/dejavu.rb
exvo-auth-0.11.1 lib/exvo_auth/dejavu.rb
exvo-auth-0.11.0 lib/exvo_auth/dejavu.rb
exvo-auth-0.10.4 lib/exvo_auth/dejavu.rb
exvo-auth-0.10.3 lib/exvo_auth/dejavu.rb
exvo-auth-0.10.2 lib/exvo_auth/dejavu.rb
exvo-auth-0.10.1 lib/exvo_auth/dejavu.rb
exvo-auth-0.10.0 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.10 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.9 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.8 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.7 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.6 lib/exvo_auth/dejavu.rb