summary refs log tree commit
path: root/lib/rack/request.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rack/request.rb')
-rw-r--r--lib/rack/request.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rack/request.rb b/lib/rack/request.rb
index 52ea652c..4f038384 100644
--- a/lib/rack/request.rb
+++ b/lib/rack/request.rb
@@ -148,7 +148,8 @@ module Rack
     # for form-data / param parsing.
     FORM_DATA_MEDIA_TYPES = [
       'application/x-www-form-urlencoded',
-      'multipart/form-data'
+      'multipart/form-data',
+      'application/json'
     ]
 
     # The set of media-types. Requests that do not indicate
@@ -366,7 +367,12 @@ module Rack
       end
 
       def parse_query(qs)
-        Utils.parse_nested_query(qs, '&')
+        case media_type
+        when 'application/json'
+          (qs && qs != '') ? ::Rack::Utils::OkJson.decode(qs) : {}
+        else
+          Utils.parse_nested_query(qs, '&')
+        end
       end
 
       def parse_multipart(env)