Class: MetaRequest::Middlewares::Headers
- Inherits:
-
Object
- Object
- MetaRequest::Middlewares::Headers
- Defined in:
- lib/meta_request/middlewares/headers.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, app_config) ⇒ Headers
constructor
A new instance of Headers.
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 |