Browse Source

Validate queries param between 1 and 500 for Sinatra tests

Ben Browning 11 years ago
parent
commit
8609a2c12c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      sinatra/hello_world.rb

+ 2 - 0
sinatra/hello_world.rb

@@ -43,6 +43,8 @@ end
 
 get '/db' do
   queries = (params[:queries] || 1).to_i
+  queries = 1 if queries < 1
+  queries = 500 if queries > 500
 
   ActiveRecord::Base.connection_pool.with_connection do
     results = (1..queries).map do