mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	Test added
This commit is contained in:
		
							parent
							
								
									56848e4ef5
								
							
						
					
					
						commit
						1f540a1714
					
				
					 2 changed files with 18 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -49,6 +49,18 @@ get '/send_file' do
 | 
			
		|||
  send_file file
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get '/streaming' do
 | 
			
		||||
  headers['Content-Length'] = '46'
 | 
			
		||||
  stream do |out|
 | 
			
		||||
    out << "It's gonna be legen -\n"
 | 
			
		||||
    sleep 0.5
 | 
			
		||||
    out << " (wait for it) \n"
 | 
			
		||||
    puts headers
 | 
			
		||||
    sleep 1
 | 
			
		||||
    out << "- dary!\n"
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
class Subclass < Sinatra::Base
 | 
			
		||||
  set :out, nil
 | 
			
		||||
  get '/subclass/async' do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -96,4 +96,9 @@ class IntegrationTest < Test::Unit::TestCase
 | 
			
		|||
    response = server.get_response '/send_file'
 | 
			
		||||
    assert response['Content-Length']
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
  it "doesn't ignore Content-Length header when streaming" do
 | 
			
		||||
    response = server.get_response '/streaming'
 | 
			
		||||
    assert response['Content-Length'], '46'
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue