Class: AppnexusApi::Faraday::Request::JsonEncode

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/appnexusapi/faraday/encode_json.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  if env[:request_headers]["Content-Type"] == nil
    env[:body] = MultiJson.encode(env[:body]) if env[:body] != nil
    env[:request_headers]["Content-Type"] = "application/json"
  end
  @app.call(env)
end