Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include CSRF <meta> elements in frame layout #697

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/views/layouts/turbo_rails/frame.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head>
<%= csrf_meta_tags %>
<%= yield :head %>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions test/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
2 changes: 1 addition & 1 deletion test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
config.action_dispatch.show_exceptions = :none

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.action_controller.allow_forgery_protection = true

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
Expand Down
2 changes: 2 additions & 0 deletions test/frames/frame_request_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Turbo::FrameRequestControllerTest < ActionDispatch::IntegrationTest

assert_select "head", count: 1
assert_select "meta[name=test][content=present]"
assert_select "meta[name=csrf-param]"
assert_select "meta[name=csrf-token]"
end

test "frame request layout can be overridden" do
Expand Down
Loading