mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	
							parent
							
								
									5d71c76554
								
							
						
					
					
						commit
						e43b2a3a01
					
				
					 3 changed files with 23 additions and 2 deletions
				
			
		|  | @ -5,7 +5,7 @@ HTTP_METHODS = %w(get post put patch delete options) | |||
| 
 | ||||
| {% for method in HTTP_METHODS %} | ||||
|   def {{method.id}}(path, &block : HTTP::Server::Context -> _) | ||||
|    Kemal::RouteHandler::INSTANCE.add_route({{method}}.upcase, path, &block) | ||||
|     Kemal::RouteHandler::INSTANCE.add_route({{method}}.upcase, path, &block) | ||||
|   end | ||||
| {% end %} | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,6 +21,10 @@ module Kemal | |||
|       @json_parsed = false | ||||
|     end | ||||
| 
 | ||||
|     private def decode_url_param(value : String) | ||||
|       value.size == 0 ? value : HTTP::Params.parse(value).first[0]? | ||||
|     end | ||||
| 
 | ||||
|     {% for method in %w(url query body json) %} | ||||
|     def {{method.id}} | ||||
|       # check memoization | ||||
|  | @ -45,7 +49,7 @@ module Kemal | |||
|     def parse_url | ||||
|       if params = @request.url_params | ||||
|         params.each do |key, value| | ||||
|           @url[key.as(String)] = value.as(String) | ||||
|           @url[key.as(String)] = decode_url_param(value).as(String) | ||||
|         end | ||||
|       end | ||||
|     end | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue