Class: Oxy::CustomHeaders
- Inherits:
-
Object
- Object
- Oxy::CustomHeaders
- Defined in:
- lib/oxy/middleware/custom_headers.rb
Overview
Simple middleware to set custom http headers
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options) ⇒ CustomHeaders
constructor
A new instance of CustomHeaders.
Constructor Details
#initialize(app, options) ⇒ CustomHeaders
Returns a new instance of CustomHeaders.
5 6 7 |
# File 'lib/oxy/middleware/custom_headers.rb', line 5 def initialize(app, ) @app, @custom_headers = app, load_from_file() end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/oxy/middleware/custom_headers.rb', line 9 def call(env) response = @app.call(env) headers = Rack::Utils::HeaderHash.new(response[1]) response[1] = headers.merge(@custom_headers) response end |