Sha256: c84906df00b2735bb2e1afa24b2b171b40856c6309277e0508884fd2aa48babd

Contents?: true

Size: 485 Bytes

Versions: 19

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true
module FinAppsCore
  module Middleware
    # This middleware sets the User-Agent request-header field to identify thei client.
    class UserAgent < Faraday::Middleware
      KEY = 'User-Agent' unless defined? KEY
      RUBY = "#{RUBY_ENGINE}/#{RUBY_PLATFORM} #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
finapps_core-2.0.20 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.19 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.18 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.17 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.16 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.15 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.14 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.13 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.12 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.11 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.10 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.9 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.8 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.7 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.6 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.5 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.4 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.3 lib/finapps_core/middleware/request/user_agent.rb
finapps_core-2.0.2 lib/finapps_core/middleware/request/user_agent.rb