Class: FinAppsCore::Middleware::UserAgent

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/finapps_core/middleware/request/user_agent.rb

Overview

This middleware sets the User-Agent request-header field to identify the client.

Constant Summary collapse

KEY =
'User-Agent'
RUBY =
"#{RUBY_ENGINE}/#{RUBY_PLATFORM} #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/finapps_core/middleware/request/user_agent.rb', line 10

def call(env)
  env[:request_headers][KEY] = "finapps-ruby/#{FinAppsCore::VERSION} (#{RUBY})"
  @app.call(env)
end