Changeset 6815
- Timestamp:
- 05/23/07 05:43:00 (1 year ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/request.rb (modified) (1 diff)
- trunk/actionpack/test/controller/cgi_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r6806 r6815 1 1 *SVN* 2 3 * Rewind request body after reading it, if possible. #8438 [s450r1] 2 4 3 5 * Resource namespaces are inherited by their has_many subresources. #8280 [marclove, ggarside] trunk/actionpack/lib/action_controller/request.rb
r6786 r6815 331 331 # Only multipart form parsing expects a stream. 332 332 if strategy && strategy != :multipart_form 333 body = body.read(content_length) 333 data = body.read(content_length) 334 body.rewind if body.respond_to?(:rewind) 335 body = data 334 336 end 335 337 trunk/actionpack/test/controller/cgi_test.rb
r6786 r6815 69 69 end 70 70 end 71 72 73 class CgiRequestNeedsRewoundTest < BaseCgiTest 74 def test_body_should_be_rewound 75 data = 'foo' 76 fake_cgi = Struct.new(:env_table, :query_string, :stdinput).new(@request_hash, '', StringIO.new(data)) 77 fake_cgi.env_table['CONTENT_LENGTH'] = data.length 78 fake_cgi.env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=utf-8' 79 80 # Read the request body by parsing params. 81 request = ActionController::CgiRequest.new(fake_cgi) 82 request.request_parameters 83 84 # Should have rewound the body. 85 assert_equal 0, request.body.pos 86 end 87 end