Skip to content

Commit

Permalink
Base#route_missing - replaces #bypassed
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Mar 26, 2009
1 parent 2887cf4 commit 8644b30
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/sinatra/base.rb
Expand Up @@ -450,12 +450,16 @@ def route!
end
end

# No matching route found or all routes passed -- forward downstream
# when running as middleware; 404 when running as normal app.
route_missing
end

# No matching route was found or all routes passed. The default
# implementation is to forward the request downstream when running
# as middleware (@app is non-nil); when no downstream app is set, raise
# a NotFound exception. Subclasses can override this method to perform
# custom route miss logic.
def route_missing
if @app
# Call bypassed method before forward to catch behavior that should
# happen even if no routes are hit.
bypassed if respond_to?(:bypassed)
forward
else
raise NotFound
Expand Down

0 comments on commit 8644b30

Please sign in to comment.