Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7064

Show
Ignore:
Timestamp:
06/19/07 18:40:28 (1 year ago)
Author:
xal
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activeresource/lib/active_resource/connection.rb

    r6864 r7064  
    7272    # Used to update resources. 
    7373    def put(path, body = '', headers = {}) 
    74       request(:put, path, body, build_request_headers(headers)) 
     74      request(:put, path, body.to_s, build_request_headers(headers)) 
    7575    end 
    7676 
     
    7878    # Used to create new resources. 
    7979    def post(path, body = '', headers = {}) 
    80       request(:post, path, body, build_request_headers(headers)) 
     80      request(:post, path, body.to_s, build_request_headers(headers)) 
    8181    end 
    8282 
  • trunk/activeresource/lib/active_resource/custom_methods.rb

    r6625 r7064  
    4040          end 
    4141       
    42           def post(method_name, options = {}, body = nil
     42          def post(method_name, options = {}, body = ''
    4343            connection.post(custom_method_collection_url(method_name, options), body, headers) 
    4444          end 
    4545       
    46           def put(method_name, options = {}, body = nil
     46          def put(method_name, options = {}, body = ''
    4747            connection.put(custom_method_collection_url(method_name, options), body, headers) 
    4848          end 
     
    7575      end 
    7676       
    77       def post(method_name, options = {}, body = nil
     77      def post(method_name, options = {}, body = ''
    7878        if new? 
    7979          connection.post(custom_method_new_element_url(method_name, options), (body.nil? ? to_xml : body), self.class.headers) 
     
    8383      end 
    8484       
    85       def put(method_name, options = {}, body = nil
     85      def put(method_name, options = {}, body = ''
    8686        connection.put(custom_method_element_url(method_name, options), body, self.class.headers) 
    8787      end