Class: Faraday::UserAgent::Middleware
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::UserAgent::Middleware
- Defined in:
- lib/ecfr/faraday/user_agent/middleware.rb
Instance Method Summary collapse
-
#initialize(app, user_agent) ⇒ Middleware
constructor
A new instance of Middleware.
- #on_request(env) ⇒ Object
Constructor Details
#initialize(app, user_agent) ⇒ Middleware
Returns a new instance of Middleware.
4 5 6 7 |
# File 'lib/ecfr/faraday/user_agent/middleware.rb', line 4 def initialize(app, user_agent) super(app) @user_agent = user_agent end |
Instance Method Details
#on_request(env) ⇒ Object
9 10 11 |
# File 'lib/ecfr/faraday/user_agent/middleware.rb', line 9 def on_request(env) env[:request_headers]["User-Agent"] = @user_agent end |