123456789_123456789_123456789_123456789_123456789_

Module: ActionController::ContentSecurityPolicy::ClassMethods

Instance Method Summary

Instance Method Details

#content_security_policy(enabled = true, **options, &block)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 17

def content_security_policy(enabled = true, **options, &block)
  before_action(options) 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)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 31

def content_security_policy_report_only(report_only = true, **options)
  before_action(options) do
    request.content_security_policy_report_only = report_only
  end
end