Class: Rack::StripHttpAcceptHeaders
- Inherits:
-
Object
- Object
- Rack::StripHttpAcceptHeaders
- Defined in:
- lib/rack/strip_http_accept_headers.rb
Overview
Strips HTTP_ACCEPT headers for all non XML HTTP requests
HTTP_ACCEPT headers are generally implemented in such a broken way in the wild, see www.gethifi.com/blog/browser-rest-http-accept-headers that unless you really need them it is best to ignore them.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ StripHttpAcceptHeaders
constructor
A new instance of StripHttpAcceptHeaders.
Constructor Details
#initialize(app) ⇒ StripHttpAcceptHeaders
Returns a new instance of StripHttpAcceptHeaders.
10 11 12 |
# File 'lib/rack/strip_http_accept_headers.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 |
# File 'lib/rack/strip_http_accept_headers.rb', line 14 def call(env) env.delete('HTTP_ACCEPT') unless Rack::Request.new(env).xhr? @app.call(env) end |