class ClientVersion

Rack middleware that adds adds a `Client-Version` header to every response with the value of the `CLIENT_VERSION` environment variable.

Constants

VERSION

Public Class Methods

new(app, client_version = ENV['CLIENT_VERSION']) click to toggle source
# File lib/client_version.rb, line 7
def initialize(app, client_version = ENV['CLIENT_VERSION'])
  @app = app
  @client_version = client_version
end

Public Instance Methods

call(env) click to toggle source
# File lib/client_version.rb, line 12
def call(env)
  @app.call(env).tap do |_, headers, _|
    headers['Client-Version'.freeze] = @client_version if @client_version
  end
end