mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Add 500 exception spec
This commit is contained in:
		
							parent
							
								
									7f198cab3b
								
							
						
					
					
						commit
						171459eee9
					
				
					 2 changed files with 11 additions and 1 deletions
				
			
		|  | @ -109,4 +109,15 @@ describe "Kemal::Handler" do | ||||||
|     response = kemal.call(request) |     response = kemal.call(request) | ||||||
|     response.status_code.should eq 404 |     response.status_code.should eq 404 | ||||||
|   end |   end | ||||||
|  | 
 | ||||||
|  |   it "renders 500 on exception" do | ||||||
|  |     kemal = Kemal::Handler.new | ||||||
|  |     kemal.add_route "GET", "/" do | ||||||
|  |       raise "Exception" | ||||||
|  |     end | ||||||
|  |     request = HTTP::Request.new("GET", "/?message=world") | ||||||
|  |     response = kemal.call(request) | ||||||
|  |     response.status_code.should eq 500 | ||||||
|  |     response.body.includes?("Exception").should eq true | ||||||
|  |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ class Kemal::Handler < HTTP::Handler | ||||||
|     end |     end | ||||||
|     # Render 404 unless a route matches |     # Render 404 unless a route matches | ||||||
|     return render_404 |     return render_404 | ||||||
|     nil |  | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def render_404 |   def render_404 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue