mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Remove call_next from RouteHandler
This commit is contained in:
		
							parent
							
								
									8f5bc755ae
								
							
						
					
					
						commit
						88aa9cd497
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		|  | @ -12,17 +12,17 @@ class Kemal::RouteHandler < HTTP::Handler | |||
| 
 | ||||
|   def call(context) | ||||
|     context.response.content_type = "text/html" | ||||
|     response = process_request(context) | ||||
|     response || call_next(context) | ||||
|     process_request(context) | ||||
|   end | ||||
| 
 | ||||
|   # Adds a given route to routing tree. As an exception each `GET` route additionaly defines | ||||
|   # a corresponding `HEAD` route. | ||||
|   def add_route(method, path, &handler : HTTP::Server::Context -> _) | ||||
|     add_to_radix_tree method, path, Route.new(method, path, &handler) | ||||
| 
 | ||||
|     # Registering HEAD route for defined GET routes. | ||||
|     add_to_radix_tree("HEAD", path, Route.new("HEAD", path, &handler)) if method == "GET" | ||||
|   end | ||||
| 
 | ||||
|   # Processes the route if it's a match. Otherwise renders 404. | ||||
|   def process_request(context) | ||||
|     url = context.request.path.not_nil! | ||||
|     Kemal::Route.check_for_method_override!(context.request) | ||||
|  | @ -38,7 +38,6 @@ class Kemal::RouteHandler < HTTP::Handler | |||
|         return render_500(context, ex.to_s) | ||||
|       end | ||||
|     end | ||||
|     # Render 404 unless a route matches | ||||
|     return render_404(context) | ||||
|   end | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue