Class: Faraday::UserAgent::Middleware

Inherits:
Middleware
  • Object
show all
Defined in:
lib/ecfr/faraday/user_agent/middleware.rb

Instance Method Summary collapse

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