Class: Alice::Request::ActiveSupportJson
- Inherits:
-
Middleware
- Object
- Middleware
- Alice::Request::ActiveSupportJson
- Defined in:
- lib/alice/request/active_support_json.rb
Instance Method Summary collapse
Methods inherited from Middleware
#create_form_params, #full_path_for, #initialize, loaded?, #process_body_for_request, setup_parallel_manager
Constructor Details
This class inherits a constructor from Alice::Middleware
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/alice/request/active_support_json.rb', line 12 def call(env) env[:request_headers]['Content-Type'] = 'application/json' if env[:body] && !env[:body].respond_to?(:to_str) env[:body] = ActiveSupport::JSON.encode env[:body] end @app.call env end |