mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Add X-Powered-By header
This commit is contained in:
		
							parent
							
								
									56067b6280
								
							
						
					
					
						commit
						0c46bd65da
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		|  | @ -164,4 +164,11 @@ describe "Kemal::RouteHandler" do | ||||||
|     client_response = call_request_on_app(request) |     client_response = call_request_on_app(request) | ||||||
|     client_response.content_type.should eq("text/html") |     client_response.content_type.should eq("text/html") | ||||||
|   end |   end | ||||||
|  | 
 | ||||||
|  |   it "sets X-Powered-By to Kemal" do | ||||||
|  |     get "/" {} | ||||||
|  |     request = HTTP::Request.new("GET", "/") | ||||||
|  |     client_response = call_request_on_app(request) | ||||||
|  |     client_response.headers["X-Powered-By"].should eq("Kemal") | ||||||
|  |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ class Kemal::RouteHandler < HTTP::Handler | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def call(context) |   def call(context) | ||||||
|  |     context.response.headers.add "X-Powered-By", "Kemal" | ||||||
|     context.response.content_type = "text/html" unless context.response.headers.has_key?("Content-Type") |     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