diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-23 05:43:00 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-23 05:43:00 +0000 |
commit | b0d01921d8fe5d54d90c9bf4aa77ba819ab52a97 (patch) | |
tree | b428af7b730039f629d94d76864dab1ad5daa526 /actionpack/test | |
parent | d418b7d39139bb881c37f0f095788ec034b98965 (diff) | |
download | rails-b0d01921d8fe5d54d90c9bf4aa77ba819ab52a97.tar.gz rails-b0d01921d8fe5d54d90c9bf4aa77ba819ab52a97.tar.bz2 rails-b0d01921d8fe5d54d90c9bf4aa77ba819ab52a97.zip |
Rewind request body after reading it, if possible. Closes #8438.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6815 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rwxr-xr-x | actionpack/test/controller/cgi_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index 4c3fbc37c5..da3ca245e1 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -68,3 +68,20 @@ class CgiRequestParamsParsingTest < BaseCgiTest assert_equal({"flamenco"=> "love"}, @request.request_parameters) end end + + +class CgiRequestNeedsRewoundTest < BaseCgiTest + def test_body_should_be_rewound + data = 'foo' + fake_cgi = Struct.new(:env_table, :query_string, :stdinput).new(@request_hash, '', StringIO.new(data)) + fake_cgi.env_table['CONTENT_LENGTH'] = data.length + fake_cgi.env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=utf-8' + + # Read the request body by parsing params. + request = ActionController::CgiRequest.new(fake_cgi) + request.request_parameters + + # Should have rewound the body. + assert_equal 0, request.body.pos + end +end |