Class: JSONAPI::Consumer::Middleware::JsonRequest

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

Instance Method Summary collapse

Instance Method Details

#call(environment) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/jsonapi/consumer/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