Class: Omniauth::Pixiv::Faraday::Request::UserAgent
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Omniauth::Pixiv::Faraday::Request::UserAgent
- Defined in:
- lib/omniauth-pixiv/faraday/request/user_agent.rb
Constant Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, user_agent) ⇒ UserAgent
constructor
A new instance of UserAgent.
Constructor Details
#initialize(app, user_agent) ⇒ UserAgent
Returns a new instance of UserAgent.
10 11 12 13 |
# File 'lib/omniauth-pixiv/faraday/request/user_agent.rb', line 10 def initialize(app, user_agent) @user_agent = user_agent super(app) end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/omniauth-pixiv/faraday/request/user_agent.rb', line 15 def call(env) env.request_headers['User-Agent'] = if env.request_headers['User-Agent'] @user_agent + " (#{env.request_headers['User-Agent']})" else @user_agent end @app.call(env) end |