diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-11 15:58:11 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-11 15:58:11 -0800 |
commit | d176af3250ef1d73d5ce3e7aa23dfe9d1dc4e40f (patch) | |
tree | 3e60202f68cab940fa265fa207e97f75af6c6dd0 /actionpack/lib/action_dispatch/http/request.rb | |
parent | 5353795c0d8d9b4c8d237548500d69d9f87c3c8d (diff) | |
parent | 991601ff6e99139e7731212d5ac87385f943fb47 (diff) | |
download | rails-d176af3250ef1d73d5ce3e7aa23dfe9d1dc4e40f.tar.gz rails-d176af3250ef1d73d5ce3e7aa23dfe9d1dc4e40f.tar.bz2 rails-d176af3250ef1d73d5ce3e7aa23dfe9d1dc4e40f.zip |
Merge pull request #8490 from mattv/fix_request_raw_post
Fix rewinding in ActionDispatch::Request#raw_post
Diffstat (limited to 'actionpack/lib/action_dispatch/http/request.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 3de927abc8..d60c8775af 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -205,8 +205,9 @@ module ActionDispatch # work with raw requests directly. def raw_post unless @env.include? 'RAW_POST_DATA' - @env['RAW_POST_DATA'] = body.read(@env['CONTENT_LENGTH'].to_i) - body.rewind if body.respond_to?(:rewind) + raw_post_body = body + @env['RAW_POST_DATA'] = raw_post_body.read(@env['CONTENT_LENGTH'].to_i) + raw_post_body.rewind if raw_post_body.respond_to?(:rewind) end @env['RAW_POST_DATA'] end |