Class: Johac::Connection::Middleware::JohacHeaders

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/johac/connection.rb

Overview

Write custom user agent to all requests.

Constant Summary collapse

AgentString =
"johac/#{Johac::Version} ruby/#{RUBY_VERSION}".freeze
Accept =
'application/json'.freeze

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



109
110
111
112
113
114
# File 'lib/johac/connection.rb', line 109

def call(env)
  env[:request_headers]['User-Agent'] = AgentString
  env[:request_headers]['Accept'] = Accept
  env[:request_headers]['Content-Type'] = Accept
  @app.call(env)
end