Class: MetaRequest::Middlewares::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_request/middlewares/headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, app_config) ⇒ Headers

Returns a new instance of Headers.



8
9
10
11
# File 'lib/meta_request/middlewares/headers.rb', line 8

def initialize(app, app_config)
  @app = app
  @app_config = app_config
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/meta_request/middlewares/headers.rb', line 13

def call(env)
  request_path = env['PATH_INFO']
  middleware = Rack::ResponseHeaders.new(@app) do |headers|
    headers['X-Meta-Request-Version'] = MetaRequest::VERSION unless skip?(request_path)
  end
  middleware.call(env)
end