Sha256: a59cecfdd4d15ea1c50a0cae55243d99201247b3682d45660f25c53489a14400

Contents?: true

Size: 440 Bytes

Versions: 2

Compression:

Stored size: 440 Bytes

Contents

require 'rack/utils'

class SessionParameterMiddleware
  def initialize(app, session_key = '_session_id')
    @app = app
    @session_key = session_key
  end

  def call(env)
    # if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
    params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
    env['HTTP_COOKIE'] = [ @session_key, params[@session_key] ].join('=').freeze unless params[@session_key].nil?
    @app.call(env)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.5 lib/iugusdk/session_parameter_middleware.rb
iugusdk-1.0.0.alpha.4 lib/iugusdk/session_parameter_middleware.rb