Module: ActionController::ContentSecurityPolicy::ClassMethods
- Defined in:
- actionpack/lib/action_controller/metal/content_security_policy.rb
Instance Method Summary collapse
- #content_security_policy(enabled = true, **options, &block) ⇒ Object
- #content_security_policy_report_only(report_only = true, **options) ⇒ Object
Instance Method Details
#content_security_policy(enabled = true, **options, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 17 def content_security_policy(enabled = true, **, &block) before_action() do if block_given? policy = current_content_security_policy yield policy request.content_security_policy = policy end unless enabled request.content_security_policy = nil end end end |
#content_security_policy_report_only(report_only = true, **options) ⇒ Object
31 32 33 34 35 |
# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 31 def content_security_policy_report_only(report_only = true, **) before_action() do request.content_security_policy_report_only = report_only end end |