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
9
10
11
# File 'lib/upfluence/http/middleware/application_headers.rb', line 5

def initialize(app, handler)
  @app = app
  @headers = {
    "X-Upfluence-Unit-Name" => handler.getName,
    "X-Upfluence-Version" => build_version(handler.getVersion)
  }
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
# File 'lib/upfluence/http/middleware/application_headers.rb', line 13

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