Sha256: 13bfebd8e02ef4f5e3346c6d1dcd22472b3c7a3260aa66e1c38d04ba3f07bb5d
Contents?: true
Size: 869 Bytes
Versions: 5
Compression:
Stored size: 869 Bytes
Contents
require 'action_dispatch/http/request' require 'active_support/core_ext/hash/indifferent_access' module ActionDispatch class ParamsParser alias :call_old :call def call(env) request = Request.new(env) mime_type = content_type_from_legacy_post_data_format_header(env) || request.content_mime_type case mime_type when Mime::JSON data = ActiveSupport::JSON.decode(request.body) request.body.rewind if request.body.respond_to?(:rewind) data = {:_json => data} unless data.is_a?(Hash) env["action_dispatch.request.request_parameters"] = {:json => data}.with_indifferent_access @app.call(env) else call_old(env) end end end end #TODO under_score the keys and use :<controller-name> instead of generic :json and put the whole thing into resty-generators
Version data entries
5 entries across 5 versions & 1 rubygems