mirror of
https://github.com/github/rails.git
synced 2026-02-01 09:44:56 -05:00
Add Integration Session methods for PUT and DELETE requests [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4317 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -143,17 +143,20 @@ module ActionController
|
||||
# (application/x-www-form-urlencoded or multipart/form-data). The headers
|
||||
# should be a hash. The keys will automatically be upcased, with the
|
||||
# prefix 'HTTP_' added if needed.
|
||||
#
|
||||
# You can also perform POST, PUT, DELETE, and HEAD requests with #post,
|
||||
# #put, #delete, and #head.
|
||||
def get(path, parameters=nil, headers=nil)
|
||||
process :get, path, parameters, headers
|
||||
end
|
||||
|
||||
# Performs a POST request with the given parameters. The parameters may
|
||||
# be +nil+, a Hash, or a string that is appropriately encoded
|
||||
# (application/x-www-form-urlencoded or multipart/form-data). The headers
|
||||
# should be a hash. The keys will automatically be upcased, with the
|
||||
# prefix 'HTTP_' added if needed.
|
||||
def post(path, parameters=nil, headers=nil)
|
||||
process :post, path, parameters, headers
|
||||
# keep the docs for #get
|
||||
%w( post put delete head ).each do |method|
|
||||
class_eval <<-EOV, __FILE__, __LINE__
|
||||
def #{method}(path, parameters=nil, headers=nil)
|
||||
process :#{method}, path, parameters, headers
|
||||
end
|
||||
EOV
|
||||
end
|
||||
|
||||
# Performs an XMLHttpRequest request with the given parameters, mimicing
|
||||
|
||||
Reference in New Issue
Block a user