diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-02-17 01:54:30 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-02-17 01:54:30 -0200 |
commit | 2572584660b2b839b19097a9b31e2657b85e5d7a (patch) | |
tree | 0fa614127486a29e5f97ad4f8ac4d8772116235e | |
parent | 5a3dd16f01429bdc06411818ea713e9e99678293 (diff) | |
parent | c4d90b70f4f27a527e9c2cd3af6cebf560b8df98 (diff) | |
download | rails-2572584660b2b839b19097a9b31e2657b85e5d7a.tar.gz rails-2572584660b2b839b19097a9b31e2657b85e5d7a.tar.bz2 rails-2572584660b2b839b19097a9b31e2657b85e5d7a.zip |
Merge pull request #23712 from bf4/incorrect_to_accept_json_api_and_not_render_spec
The JSON API media type should only work wih a JSON API handler
-rw-r--r-- | actionpack/lib/action_dispatch/http/mime_types.rb | 2 | ||||
-rw-r--r-- | actionpack/test/dispatch/request/json_params_parsing_test.rb | 11 |
2 files changed, 3 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_types.rb b/actionpack/lib/action_dispatch/http/mime_types.rb index 95881acac3..66cea88256 100644 --- a/actionpack/lib/action_dispatch/http/mime_types.rb +++ b/actionpack/lib/action_dispatch/http/mime_types.rb @@ -28,7 +28,7 @@ Mime::Type.register "application/x-www-form-urlencoded", :url_encoded_form # http://www.ietf.org/rfc/rfc4627.txt # http://www.json.org/JSONRequest.html -Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest application/vnd.api+json ) +Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest ) Mime::Type.register "application/pdf", :pdf, [], %w(pdf) Mime::Type.register "application/zip", :zip, [], %w(zip) diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index a3992ad008..71ad31ee15 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -37,9 +37,9 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest ) end - test "parses json params for application/vnd.api+json" do + test "does not parses unregistered media types such as application/vnd.api+json" do assert_parses( - {"person" => {"name" => "David"}}, + {}, "{\"person\": {\"name\": \"David\"}}", { 'CONTENT_TYPE' => 'application/vnd.api+json' } ) end @@ -143,13 +143,6 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest ) end - test "parses json params for application/vnd.api+json" do - assert_parses( - {"user" => {"username" => "sikachu"}, "username" => "sikachu"}, - "{\"username\": \"sikachu\"}", { 'CONTENT_TYPE' => 'application/vnd.api+json' } - ) - end - test "parses json with non-object JSON content" do assert_parses( {"user" => {"_json" => "string content" }, "_json" => "string content" }, |