From e468e2e340f23d0a0e4b0c86c2c3dc1f58c23fdc Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol Date: Mon, 13 Aug 2018 19:21:18 +0300 Subject: [PATCH] route_defined? -> route_found? --- src/kemal/ext/context.cr | 4 ++-- src/kemal/filter_handler.cr | 2 +- src/kemal/route_handler.cr | 2 +- src/kemal/websocket_handler.cr | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kemal/ext/context.cr b/src/kemal/ext/context.cr index 9f2d3c0..f9a12ca 100644 --- a/src/kemal/ext/context.cr +++ b/src/kemal/ext/context.cr @@ -34,7 +34,7 @@ class HTTP::Server Kemal::RouteHandler::INSTANCE.lookup_route(@request.method.as(String), @request.path) end - def route_defined? + def route_found? route_lookup.found? end @@ -42,7 +42,7 @@ class HTTP::Server Kemal::WebSocketHandler::INSTANCE.lookup_ws_route(@request.path) end - def ws_route_defined? + def ws_route_found? ws_route_lookup.found? end diff --git a/src/kemal/filter_handler.cr b/src/kemal/filter_handler.cr index 716e25e..38b84fe 100644 --- a/src/kemal/filter_handler.cr +++ b/src/kemal/filter_handler.cr @@ -12,7 +12,7 @@ module Kemal # The call order of the filters is `before_all -> before_x -> X -> after_x -> after_all`. def call(context : HTTP::Server::Context) - return call_next(context) unless context.route_defined? + return call_next(context) unless context.route_found? call_block_for_path_type("ALL", context.request.path, :before, context) call_block_for_path_type(context.request.method, context.request.path, :before, context) if Kemal.config.error_handlers.has_key?(context.response.status_code) diff --git a/src/kemal/route_handler.cr b/src/kemal/route_handler.cr index 6e39603..95f9050 100644 --- a/src/kemal/route_handler.cr +++ b/src/kemal/route_handler.cr @@ -29,7 +29,7 @@ module Kemal # Processes the route if it's a match. Otherwise renders 404. private def process_request(context) - raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined? + raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_found? content = context.route.handler.call(context) if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(context.response.status_code) diff --git a/src/kemal/websocket_handler.cr b/src/kemal/websocket_handler.cr index 9550bef..d1f3c76 100644 --- a/src/kemal/websocket_handler.cr +++ b/src/kemal/websocket_handler.cr @@ -10,7 +10,7 @@ module Kemal end def call(context : HTTP::Server::Context) - return call_next(context) unless context.ws_route_defined? && websocket_upgrade_request?(context) + return call_next(context) unless context.ws_route_found? && websocket_upgrade_request?(context) content = context.websocket.call(context) context.response.print(content) context