mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	allow to set optional response body on redirects (#561)
This commit is contained in:
		
							parent
							
								
									4d6fb0614f
								
							
						
					
					
						commit
						b7506f6fab
					
				
					 2 changed files with 14 additions and 1 deletions
				
			
		|  | @ -17,9 +17,10 @@ class HTTP::Server | |||
|       @params ||= Kemal::ParamParser.new(@request, route_lookup.params) | ||||
|     end | ||||
| 
 | ||||
|     def redirect(url : String, status_code : Int32 = 302) | ||||
|     def redirect(url : String, status_code : Int32 = 302, *, body : String? = nil) | ||||
|       @response.headers.add "Location", url | ||||
|       @response.status_code = status_code | ||||
|       @response.print(body) if body | ||||
|     end | ||||
| 
 | ||||
|     def route | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue