edge badge
Methods
C
N
Constants
CONTENT_TYPE = "Content-Type"
 
POLICY = "Feature-Policy"
 
Class Public methods
new(app)
# File actionpack/lib/action_dispatch/http/feature_policy.rb, line 11
def initialize(app)
  @app = app
end
Instance Public methods
call(env)
# File actionpack/lib/action_dispatch/http/feature_policy.rb, line 15
def call(env)
  request = ActionDispatch::Request.new(env)
  _, headers, _ = response = @app.call(env)

  return response unless html_response?(headers)
  return response if policy_present?(headers)

  if policy = request.feature_policy
    headers[POLICY] = policy.build(request.controller_instance)
  end

  if policy_empty?(policy)
    headers.delete(POLICY)
  end

  response
end