Permalink
Browse files

Ensure that post and put requests pass in Content-Length to the server.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 6af2cbc commit bf280157d9c92637a3a270510b2ff67be27a302e Tobias Lütke committed Jun 19, 2007
@@ -71,13 +71,13 @@ def delete(path, headers = {})
# Execute a PUT request (see HTTP protocol documentation if unfamiliar).
# Used to update resources.
def put(path, body = '', headers = {})
- request(:put, path, body, build_request_headers(headers))
+ request(:put, path, body.to_s, build_request_headers(headers))
end
# Execute a POST request.
# Used to create new resources.
def post(path, body = '', headers = {})
- request(:post, path, body, build_request_headers(headers))
+ request(:post, path, body.to_s, build_request_headers(headers))
end
def xml_from_response(response)
@@ -39,11 +39,11 @@ def get(method_name, options = {})
connection.get(custom_method_collection_url(method_name, options), headers)
end
- def post(method_name, options = {}, body = nil)
+ def post(method_name, options = {}, body = '')
connection.post(custom_method_collection_url(method_name, options), body, headers)
end
- def put(method_name, options = {}, body = nil)
+ def put(method_name, options = {}, body = '')
connection.put(custom_method_collection_url(method_name, options), body, headers)
end
@@ -74,15 +74,15 @@ def get(method_name, options = {})
connection.get(custom_method_element_url(method_name, options), self.class.headers)
end
- def post(method_name, options = {}, body = nil)
+ def post(method_name, options = {}, body = '')
if new?
connection.post(custom_method_new_element_url(method_name, options), (body.nil? ? to_xml : body), self.class.headers)
else
connection.post(custom_method_element_url(method_name, options), body, self.class.headers)
end
end
- def put(method_name, options = {}, body = nil)
+ def put(method_name, options = {}, body = '')
connection.put(custom_method_element_url(method_name, options), body, self.class.headers)
end

0 comments on commit bf28015

Please sign in to comment.