Class: Upfluence::HTTP::Middleware::ApplicationHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/upfluence/http/middleware/application_headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, handler) ⇒ ApplicationHeaders

Returns a new instance of ApplicationHeaders.



5
6
7
8
# File 'lib/upfluence/http/middleware/application_headers.rb', line 5

def initialize(app, handler)
  @app = app
  @headers = handler ? build_headers(handler) : {}
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/upfluence/http/middleware/application_headers.rb', line 10

def call(env)
  status, header, body = @app.call(env)
  [status, header.merge(@headers), body]
end