mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	route_defined? -> route_found?
This commit is contained in:
		
							parent
							
								
									2b3ae85c34
								
							
						
					
					
						commit
						e468e2e340
					
				
					 4 changed files with 5 additions and 5 deletions
				
			
		|  | @ -34,7 +34,7 @@ class HTTP::Server | ||||||
|       Kemal::RouteHandler::INSTANCE.lookup_route(@request.method.as(String), @request.path) |       Kemal::RouteHandler::INSTANCE.lookup_route(@request.method.as(String), @request.path) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def route_defined? |     def route_found? | ||||||
|       route_lookup.found? |       route_lookup.found? | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  | @ -42,7 +42,7 @@ class HTTP::Server | ||||||
|       Kemal::WebSocketHandler::INSTANCE.lookup_ws_route(@request.path) |       Kemal::WebSocketHandler::INSTANCE.lookup_ws_route(@request.path) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def ws_route_defined? |     def ws_route_found? | ||||||
|       ws_route_lookup.found? |       ws_route_lookup.found? | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ module Kemal | ||||||
| 
 | 
 | ||||||
|     # The call order of the filters is `before_all -> before_x -> X -> after_x -> after_all`. |     # The call order of the filters is `before_all -> before_x -> X -> after_x -> after_all`. | ||||||
|     def call(context : HTTP::Server::Context) |     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("ALL", context.request.path, :before, context) | ||||||
|       call_block_for_path_type(context.request.method, 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) |       if Kemal.config.error_handlers.has_key?(context.response.status_code) | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ module Kemal | ||||||
| 
 | 
 | ||||||
|     # Processes the route if it's a match. Otherwise renders 404. |     # Processes the route if it's a match. Otherwise renders 404. | ||||||
|     private def process_request(context) |     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) |       content = context.route.handler.call(context) | ||||||
| 
 | 
 | ||||||
|       if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(context.response.status_code) |       if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(context.response.status_code) | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ module Kemal | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def call(context : HTTP::Server::Context) |     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) |       content = context.websocket.call(context) | ||||||
|       context.response.print(content) |       context.response.print(content) | ||||||
|       context |       context | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue