Class: DIDWW::BaseMiddleware
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- DIDWW::BaseMiddleware
- Defined in:
- lib/didww/base_middleware.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#call(request_env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/didww/base_middleware.rb', line 5 def call(request_env) headers = {} headers['Api-Key'] = DIDWW::Client.api_key headers['User-Agent'] = "didww-v3 Ruby gem v#{VERSION}" headers['x-didww-api-version'] = DIDWW::Client.api_version unless DIDWW::Client.api_version.blank? request_env[:request_headers].merge!(headers) request_env.url.host = URI(DIDWW::Client.api_base_url).host @app.call(request_env).on_complete do |response_env| # do something with the response # response_env[:response_headers].merge!(...) end end |