From f6746c024531740900d79236944ce11c65608cde Mon Sep 17 00:00:00 2001 From: Paul Nikitochkin Date: Mon, 8 Jul 2013 01:32:22 +0300 Subject: 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 --- actionpack/test/dispatch/request/json_params_parsing_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/test/dispatch/request/json_params_parsing_test.rb') 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 -- cgit v1.2.3