I have been modifying Tobias Luetke's "Opinion 2" forum to run with
rails trunk and noticed that the ToolsController#preview_textile
action breaks on changeset [6764]. The problem is that
request.raw_post returns an empty string because
CgiRequest#body is a StringIO object that was read and not
rewound. The attached patch rewind_request_body.diff includes a
unit test illustrating the problem and code to rewind the body.
Here is the unit test that fails:
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'
request = ActionController::CgiRequest.new(fake_cgi)
request.request_parameters
assert_equal(0, request.body.pos)
end
end
About your application's environment
Ruby version 1.8.5 (i486-linux)
RubyGems version 0.9.2
Rails version 1.2.3
Active Record version 1.15.3
Action Pack version 1.13.3
Action Web Service version 1.2.3
Action Mailer version 1.3.3
Active Support version 1.4.2
Edge Rails revision 6813
Application root /home/jad/src/opinion
Environment development
Database adapter sqlite3
Database schema version 31
Also used mongrel 1.0.1 and firefox 2.0.0.2 for testing.