Class: Userbin::Request::Middleware::EnvironmentHeaders

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/userbin/request.rb

Overview

Adds details about current environment

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object


62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/userbin/request.rb', line 62

def call(env)
  begin
    env[:request_headers]["X-Userbin-Client-User-Agent"] =
      MultiJson.encode(Userbin::Request.client_user_agent)
  rescue # ignored
  end

  env[:request_headers]["User-Agent"] =
    "Userbin/v1 RubyBindings/#{Userbin::VERSION}"

  @app.call(env)
end