class Gorilla::Middleware::ApiVersion

Constants

VERSION_HEADER

Public Class Methods

new(app, version) click to toggle source
Calls superclass method
# File lib/gorilla/middleware/api_version.rb, line 7
def initialize(app, version)
  super(app)
  @version = version
end

Public Instance Methods

call(env) click to toggle source
# File lib/gorilla/middleware/api_version.rb, line 12
def call(env)
  env[:request_headers]['Accept'] = accept_header
  @app.call(env)
end

Private Instance Methods

accept_header() click to toggle source
# File lib/gorilla/middleware/api_version.rb, line 19
def accept_header
  VERSION_HEADER % @version
end