Class: Bowtie::Middleware::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/bowtie/middleware/session.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Session

Returns a new instance of Session.



3
4
5
# File 'lib/bowtie/middleware/session.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/bowtie/middleware/session.rb', line 7

def call(env)
  status, headers, response = @app.call(env)

  if headers['X-Bowtie-Client-Session']
    env['rack.session']['user'] = JSON.parse(headers['X-Bowtie-Client-Session'].first)
  end

  [status, headers, response]
end