Class: Rack::Accepts

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/accepts/accepts.rb,
lib/rack/accepts/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Accepts

Returns a new instance of Accepts.



3
4
5
# File 'lib/rack/accepts/accepts.rb', line 3

def initialize(app)  
  @app = app  
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/rack/accepts/accepts.rb', line 7

def call(env)  
  if some_bad_accepts_headers?
    Rack::Response.new([], 406).finish
  else
    @app.call(env)
  end
end