Class: JsonApiClient::Middleware::JsonRequest

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/json_api_client/middleware/json_request.rb

Instance Method Summary collapse

Instance Method Details

#call(environment) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/json_api_client/middleware/json_request.rb', line 4

def call(environment)
  accept_header = update_accept_header(environment[:request_headers])

  environment[:request_headers]["Content-Type"] = 'application/vnd.api+json'
  environment[:request_headers]["Accept"] = accept_header
  @app.call(environment)
end