Class: Rack::Csp
- Inherits:
-
Object
- Object
- Rack::Csp
- Defined in:
- lib/rack/csp.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, policy:) ⇒ Csp
constructor
A new instance of Csp.
Constructor Details
#initialize(app, policy:) ⇒ Csp
Returns a new instance of Csp.
7 8 9 10 |
# File 'lib/rack/csp.rb', line 7 def initialize(app, policy:) @app = app @policy = policy end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 |
# File 'lib/rack/csp.rb', line 12 def call(env) status, headers, body = @app.call(env) headers["Content-Security-Policy"] = @policy [status, headers, body] end |