1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove deprecated Rails.config.action_dispatch.hosts_response_app

This commit is contained in:
Rafael Mendonça França 2021-10-13 20:46:26 +00:00
parent 073baba024
commit 4f5989bf91
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
5 changed files with 8 additions and 17 deletions

View file

@ -1,3 +1,7 @@
* Remove deprecated `Rails.config.action_dispatch.hosts_response_app`.
*Rafael Mendonça França*
* Remove deprecated `ActionDispatch::Response.return_only_media_type_on_content_type`.
*Rafael Mendonça França*

View file

@ -98,20 +98,11 @@ module ActionDispatch
end
end
def initialize(app, hosts, deprecated_response_app = nil, exclude: nil, response_app: nil)
def initialize(app, hosts, exclude: nil, response_app: nil)
@app = app
@permissions = Permissions.new(hosts)
@exclude = exclude
unless deprecated_response_app.nil?
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`action_dispatch.hosts_response_app` is deprecated and will be ignored in Rails 7.0.
Use the Host Authorization `response_app` setting instead.
MSG
response_app ||= deprecated_response_app
end
@response_app = response_app || DefaultResponseApp.new
end

View file

@ -259,12 +259,6 @@ class HostAuthorizationTest < ActionDispatch::IntegrationTest
assert_match "Blocked host: sub-example.com", response.body
end
test "config setting action_dispatch.hosts_response_app is deprecated" do
assert_deprecated do
ActionDispatch::HostAuthorization.new(App, "example.com", ->(env) { true })
end
end
test "uses logger from the env" do
@app = ActionDispatch::HostAuthorization.new(App, %w(only.com))
output = StringIO.new

View file

@ -54,6 +54,8 @@ Please refer to the [Changelog][action-pack] for detailed changes.
* Remove deprecated `ActionDispatch::Response.return_only_media_type_on_content_type`.
* Remove deprecated `Rails.config.action_dispatch.hosts_response_app`.
### Deprecations
### Notable changes

View file

@ -13,7 +13,7 @@ module Rails
def build_stack
ActionDispatch::MiddlewareStack.new do |middleware|
middleware.use ::ActionDispatch::HostAuthorization, config.hosts, config.action_dispatch.hosts_response_app, **config.host_authorization
middleware.use ::ActionDispatch::HostAuthorization, config.hosts, **config.host_authorization
if config.force_ssl
middleware.use ::ActionDispatch::SSL, **config.ssl_options,