Class: Rack::XFrameOptions
- Inherits:
-
Object
- Object
- Rack::XFrameOptions
- Defined in:
- lib/rack/xframe-options.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, value = "SAMEORIGIN") ⇒ XFrameOptions
constructor
A new instance of XFrameOptions.
Constructor Details
#initialize(app, value = "SAMEORIGIN") ⇒ XFrameOptions
Returns a new instance of XFrameOptions.
4 5 6 7 |
# File 'lib/rack/xframe-options.rb', line 4 def initialize(app, value = "SAMEORIGIN") @app = app @value = value.upcase end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/xframe-options.rb', line 9 def call(env) status, headers, body = @app.call(env) if headers['Content-Type'] =~ /html/ headers['X-Frame-Options'] = ["DENY", "SAMEORIGIN"].include?(@value) ? @value : "DENY" end [status, headers, body] end |