Class: Faraday::Request::ActiveSupportJson
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::Request::ActiveSupportJson
- Defined in:
- lib/faraday/request/active_support_json.rb
Instance Method Summary collapse
Methods inherited from Middleware
#initialize, loaded?, setup_parallel_manager
Constructor Details
This class inherits a constructor from Faraday::Middleware
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/faraday/request/active_support_json.rb', line 13 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 |