mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Inherit response.content type from filter if it's given. Fixes #146.
This commit is contained in:
		
							parent
							
								
									c2edc89992
								
							
						
					
					
						commit
						92d7273759
					
				
					 2 changed files with 10 additions and 1 deletions
				
			
		|  | @ -155,4 +155,13 @@ describe "Kemal::RouteHandler" do | ||||||
|     client_response.status_code.should eq(302) |     client_response.status_code.should eq(302) | ||||||
|     client_response.headers.has_key?("Location").should eq(true) |     client_response.headers.has_key?("Location").should eq(true) | ||||||
|   end |   end | ||||||
|  | 
 | ||||||
|  |   it "sets default Content-Type to context html" do | ||||||
|  |     get "/" do |env| | ||||||
|  |       "Hello World from GET" | ||||||
|  |     end | ||||||
|  |     request = HTTP::Request.new("GET", "/") | ||||||
|  |     client_response = call_request_on_app(request) | ||||||
|  |     client_response.content_type.should eq("text/html") | ||||||
|  |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ class Kemal::RouteHandler < HTTP::Handler | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def call(context) |   def call(context) | ||||||
|     context.response.content_type = "text/html" |     context.response.content_type = "text/html" unless context.response.headers.has_key?("Content-Type") | ||||||
|     process_request(context) |     process_request(context) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue