mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Merge pull request #78 from MakeNowJust/patch-1
Use 302 to redirect instead of 301
This commit is contained in:
		
						commit
						70ef8a7718
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		|  | @ -204,7 +204,7 @@ describe "Kemal::RouteHandler" do | |||
|     request = HTTP::Request.new("GET", "/") | ||||
|     io_with_context = create_request_and_return_io(kemal, request) | ||||
|     client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false) | ||||
|     client_response.status_code.should eq(301) | ||||
|     client_response.status_code.should eq(302) | ||||
|     client_response.headers.has_key?("Location").should eq(true) | ||||
|   end | ||||
| end | ||||
|  |  | |||
|  | @ -8,9 +8,9 @@ class HTTP::Server | |||
|       Kemal::ParamParser.new(@route, @request).parse | ||||
|     end | ||||
| 
 | ||||
|     def redirect(url) | ||||
|     def redirect(url, status_code = 302) | ||||
|       @response.headers.add "Location", url | ||||
|       @response.status_code = 301 | ||||
|       @response.status_code = status_code | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue