跳至内容 跳至搜索
方法
C
N

类公共方法

new(app)

# File actionpack/lib/action_dispatch/http/permissions_policy.rb, line 33
def initialize(app)
  @app = app
end

实例公共方法

call(env)

# File actionpack/lib/action_dispatch/http/permissions_policy.rb, line 37
def call(env)
  _, headers, _ = response = @app.call(env)

  return response if policy_present?(headers)

  request = ActionDispatch::Request.new(env)

  if policy = request.permissions_policy
    headers[ActionDispatch::Constants::FEATURE_POLICY] = policy.build(request.controller_instance)
  end

  if policy_empty?(policy)
    headers.delete(ActionDispatch::Constants::FEATURE_POLICY)
  end

  response
end