Remove deprecated support for status option in head

上级 6c24e47e
* Remove deprecated support to passing status as option `head`.
*Rafael Mendonça França*
* Remove deprecated support to passing original exception to `ActionController::BadRequest`
and the `ActionController::BadRequest#original_exception` method.
......
......@@ -18,13 +18,7 @@ module Head
# See Rack::Utils::SYMBOL_TO_STATUS_CODE for a full list of valid +status+ symbols.
def head(status, options = {})
if status.is_a?(Hash)
msg = status[:status] ? "The :status option" : "The implicit :ok status"
options, status = status, status.delete(:status)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
#{msg} on `head` has been deprecated and will be removed in Rails 5.1.
Please pass the status as a separate parameter before the options, instead.
MSG
raise ArgumentError, "#{status.inspect} is not a valid value for `status`."
end
status ||= :ok
......
......@@ -173,14 +173,6 @@ def handle_last_modified_and_etags
fresh_when(last_modified: Time.now.utc.beginning_of_day, etag: [ :foo, 123 ])
end
def head_with_status_hash
head status: :created
end
def head_with_hash_does_not_include_status
head warning: :deprecated
end
def head_created
head :created
end
......@@ -670,19 +662,6 @@ def test_head_created
assert_response :created
end
def test_passing_hash_to_head_as_first_parameter_deprecated
assert_deprecated do
get :head_with_status_hash
end
end
def test_head_with_default_value_is_deprecated
assert_deprecated do
get :head_with_hash_does_not_include_status
assert_response :ok
end
end
def test_head_created_with_application_json_content_type
post :head_created_with_application_json_content_type
assert @response.body.blank?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册