Class: Rack::BounceFavicon

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/contrib/bounce_favicon.rb

Overview

Bounce those annoying favicon.ico requests

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ BounceFavicon

Returns a new instance of BounceFavicon.



6
7
8
# File 'lib/rack/contrib/bounce_favicon.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rack/contrib/bounce_favicon.rb', line 10

def call(env)
  if env["PATH_INFO"] == "/favicon.ico"
    [404, {"content-type" => "text/html", "content-length" => "0"}, []]
  else
    @app.call(env)
  end
end