Fixes an issue where an error is raised when a new rails app hits the internal rails welcome page, the exception is ActionController::RequestForgeryProtection::DisabledSessionError

Co-authored-by: Petrik de Heus <petrik@deheus.net>
This commit is contained in:
Haroon Ahmed 2021-07-24 22:33:03 +01:00
parent 366c8f081d
commit 26720d5a3c
2 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@
require "rails/application_controller"
class Rails::WelcomeController < Rails::ApplicationController # :nodoc:
skip_forgery_protection
layout false
def index

View File

@ -734,5 +734,18 @@ module ApplicationTests
get "/url"
assert_equal "/foo", last_response.body
end
test "request to rails/welcome for api_only app is successful" do
add_to_config <<-RUBY
config.api_only = true
config.action_dispatch.show_exceptions = false
config.action_controller.allow_forgery_protection = true
RUBY
app "development"
get "/"
assert_equal 200, last_response.status
end
end
end