Skip to content

Commit 8f9f7e7

Browse files
authored
Merge pull request rails#42864 from hahmed/ha/new-rails-api-app-errors-on-welcome-controller
Fixes DisabledSessionError with new rails api app
2 parents 0253772 + 26720d5 commit 8f9f7e7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

railties/lib/rails/welcome_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require "rails/application_controller"
44

55
class Rails::WelcomeController < Rails::ApplicationController # :nodoc:
6+
skip_forgery_protection
67
layout false
78

89
def index

railties/test/application/routing_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,5 +734,18 @@ def index
734734
get "/url"
735735
assert_equal "/foo", last_response.body
736736
end
737+
738+
test "request to rails/welcome for api_only app is successful" do
739+
add_to_config <<-RUBY
740+
config.api_only = true
741+
config.action_dispatch.show_exceptions = false
742+
config.action_controller.allow_forgery_protection = true
743+
RUBY
744+
745+
app "development"
746+
747+
get "/"
748+
assert_equal 200, last_response.status
749+
end
737750
end
738751
end

0 commit comments

Comments
 (0)