Class: Rack::Heroku::NoSuchApp

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/heroku/no-such-app.rb

Constant Summary collapse

VERSION =
"0.1.0"
HEROKUAPP_DOMAIN_REGEXP =
/.+\.heroku(app)?\.com/

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ NoSuchApp

Returns a new instance of NoSuchApp.



8
9
10
# File 'lib/rack/heroku/no-such-app.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rack/heroku/no-such-app.rb', line 12

def call(env)
  if HEROKUAPP_DOMAIN_REGEXP === (env['HTTP_HOST'] || env['SERVER_NAME'])
    return [404, headers, [body]]
  end

  @app.call(env)
end