mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Removed deprecated form of calling xml_http_request/xhr without the first argument being the http verb [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7436 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Removed deprecated form of calling xml_http_request/xhr without the first argument being the http verb [DHH]
|
||||
|
||||
* Removed deprecated methods [DHH]:
|
||||
|
||||
- ActionController::Base#keep_flash (use flash.keep instead)
|
||||
|
||||
@@ -183,16 +183,7 @@ module ActionController
|
||||
# parameters are +nil+, a hash, or a url-encoded or multipart string;
|
||||
# the headers are a hash. Keys are automatically upcased and prefixed
|
||||
# with 'HTTP_' if not already.
|
||||
#
|
||||
# This method used to omit the request_method parameter, assuming it
|
||||
# was :post. This was deprecated in Rails 1.2.4. Always pass the request
|
||||
# method as the first argument.
|
||||
def xml_http_request(request_method, path, parameters = nil, headers = nil)
|
||||
unless request_method.is_a?(Symbol)
|
||||
ActiveSupport::Deprecation.warn 'xml_http_request now takes the request_method (:get, :post, etc.) as the first argument. It used to assume :post, so add the :post argument to your existing method calls to silence this warning.'
|
||||
request_method, path, parameters, headers = :post, request_method, path, parameters
|
||||
end
|
||||
|
||||
headers ||= {}
|
||||
headers['X-Requested-With'] = 'XMLHttpRequest'
|
||||
headers['Accept'] = 'text/javascript, text/html, application/xml, text/xml, */*'
|
||||
|
||||
@@ -130,16 +130,6 @@ class SessionTest < Test::Unit::TestCase
|
||||
@session.head(path,params,headers)
|
||||
end
|
||||
|
||||
def test_xml_http_request_deprecated_call
|
||||
path = "/index"; params = "blah"; headers = {:location => 'blah'}
|
||||
headers_after_xhr = headers.merge(
|
||||
"X-Requested-With" => "XMLHttpRequest",
|
||||
"Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
|
||||
)
|
||||
@session.expects(:process).with(:post,path,params,headers_after_xhr)
|
||||
assert_deprecated { @session.xml_http_request(path,params,headers) }
|
||||
end
|
||||
|
||||
def test_xml_http_request_get
|
||||
path = "/index"; params = "blah"; headers = {:location => 'blah'}
|
||||
headers_after_xhr = headers.merge(
|
||||
|
||||
Reference in New Issue
Block a user