Class: Rack::HeadersFilter
- Inherits:
-
Object
- Object
- Rack::HeadersFilter
- Defined in:
- lib/rack/headers_filter.rb
Constant Summary collapse
- BLACKLIST_HEADERS =
%w[ HTTP_X_FORWARDED_HOST ]
Instance Attribute Summary collapse
-
#remove_headers ⇒ Object
readonly
Returns the value of attribute remove_headers.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, blacklist_headers: BLACKLIST_HEADERS) ⇒ HeadersFilter
constructor
A new instance of HeadersFilter.
Constructor Details
#initialize(app, blacklist_headers: BLACKLIST_HEADERS) ⇒ HeadersFilter
Returns a new instance of HeadersFilter.
9 10 11 12 |
# File 'lib/rack/headers_filter.rb', line 9 def initialize(app, blacklist_headers: BLACKLIST_HEADERS) @remove_headers = blacklist_headers @app = app end |
Instance Attribute Details
#remove_headers ⇒ Object (readonly)
Returns the value of attribute remove_headers.
7 8 9 |
# File 'lib/rack/headers_filter.rb', line 7 def remove_headers @remove_headers end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 |
# File 'lib/rack/headers_filter.rb', line 14 def call(env) @remove_headers.each { |header| env.delete(header) } @app.call(env) end |