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

Ticket #5235: raw_post_data_fix_for_put.diff

File raw_post_data_fix_for_put.diff, 1.1 kB (added by guy.naor@famundo.com, 2 years ago)

Patch + tests to make multipart requests work with PUT

  • actionpack/test/controller/cgi_test.rb

    old new  
    315315    end 
    316316end 
    317317 
     318# Makes sure that a HTTP PUT works with Multipart as well as POST 
     319class PutMultipartCGITest < MultipartCGITest 
     320  def setup 
     321    super 
     322    ENV['REQUEST_METHOD'] = 'PUT' 
     323  end 
     324end 
    318325 
    319326class CGIRequestTest < Test::Unit::TestCase 
    320327  def setup 
  • actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb

    old new  
    1515        method = :get 
    1616      end 
    1717 
    18       if method == :post && (boundary = multipart_form_boundary) 
     18      if ((method == :post) || (method == :put)) && (boundary = multipart_form_boundary) 
    1919        @multipart = true 
    2020        @params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH'])) 
    2121      else