Class: FinAppsCore::Middleware::AcceptJson

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/finapps_core/middleware/request/accept_json.rb

Overview

This middleware sets the Accept request-header field to specify JSON as acceptable media type for the response.

Constant Summary collapse

KEY =
'Accept'

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/finapps_core/middleware/request/accept_json.rb', line 10

def call(env)
  env[:request_headers][KEY] = 'application/json'
  @app.call(env)
end