Class: Response::ParseJson

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/faraday/response/parse_json.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/faraday/response/parse_json.rb', line 5

def call(env)
  @app.call(env).on_complete do
    if (env[:response_headers]["content-type"] || "").include?("application/json")
      env[:body] = convert_to_json(env[:body])
    end
  end
end