Class: RequestHeadersMiddleware::Middleware

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

Overview

The Middleware that stores the header. Default is only to store the X-Request-Id or the action_dispatch.request_id from environment if not set.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



9
10
11
# File 'lib/request_headers_middleware/middleware.rb', line 9

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
# File 'lib/request_headers_middleware/middleware.rb', line 13

def call(env)
  RequestStore.store[:headers] = filter(headers(env))
  RequestHeadersMiddleware.callbacks.each { |cb| cb.call(env) }
  @app.call(env)
end