diff options
author | Paul Nikitochkin <paul.nikitochkin@gmail.com> | 2013-07-08 01:32:22 +0300 |
---|---|---|
committer | Paul Nikitochkin <paul.nikitochkin@gmail.com> | 2013-07-08 01:48:35 +0300 |
commit | f6746c024531740900d79236944ce11c65608cde (patch) | |
tree | bb077404dea7a004a53a717038482ea66786edb9 /actionpack/test/dispatch | |
parent | b18a27375a62b7c9848cd2dc7b5cf152ef61b62f (diff) | |
download | rails-f6746c024531740900d79236944ce11c65608cde.tar.gz rails-f6746c024531740900d79236944ce11c65608cde.tar.bz2 rails-f6746c024531740900d79236944ce11c65608cde.zip |
Use Request#raw_post instead Request#body
In order to get raw_post to be not empty after
ParamsParser#parse_formatted_parameters,
added rewinding of body stream input on parsing json params.
Closes #11345
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/request/json_params_parsing_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index b62ed6a8b2..dba9ab688f 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -70,6 +70,13 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest end end + test 'raw_post is not empty for JSON request' do + with_test_routing do + post '/parse', '{"posts": [{"title": "Post Title"}]}', 'CONTENT_TYPE' => 'application/json' + assert_equal '{"posts": [{"title": "Post Title"}]}', request.raw_post + end + end + private def assert_parses(expected, actual, headers = {}) with_test_routing do |