Class: AffiliationId::Middleware::Faraday
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- AffiliationId::Middleware::Faraday
- Defined in:
- lib/affiliation_id/middleware/faraday.rb
Overview
Faraday::Middleware for handling requests made with Faraday with affiliation_id
Usage:
conn = Faraday.new do |f|
f.request :affiliation_id # include AffiliationID.current_id in the request headers
f.adapter :net_http # Use the Net::HTTP adapter
end
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 |
# File 'lib/affiliation_id/middleware/faraday.rb', line 19 def call(env) env[:request_headers][config.header_name] ||= AffiliationId.current_id @app.call(env) end |