Sha256: 159ba2ca9dbd079716ccba1e24f53842d5afe889331c446018e39da8cb227d41

Contents?: true

Size: 477 Bytes

Versions: 24

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true
module FinApps
  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/#{FinApps::VERSION} (#{RUBY})"
        @app.call(env)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
finapps-2.1.4 lib/finapps/middleware/request/user_agent.rb
finapps-2.1.3 lib/finapps/middleware/request/user_agent.rb
finapps-2.1.2 lib/finapps/middleware/request/user_agent.rb
finapps-2.1.1 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.30 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.29 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.28 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.27 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.26 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.25 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.24 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.23 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.22 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.21 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.20 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.19 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.17 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.16 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.15 lib/finapps/middleware/request/user_agent.rb
finapps-2.0.14 lib/finapps/middleware/request/user_agent.rb