Explorar o código

verify Fixed kelp's db test

Mike Smith %!s(int64=11) %!d(string=hai) anos
pai
achega
91ada4c2c8
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      kelp/app.pl

+ 7 - 2
kelp/app.pl

@@ -18,8 +18,13 @@ get '/db' => sub {
         my $id = int rand 10000 + 1;
         $sth->execute($id);
         if ( my $row = $sth->fetchrow_hashref ) {
-            push @response,
-              { id => $id, randomNumber => $row->{randomNumber} };
+            if ( $queries == 1 ) {
+                return { id => $id, randomNumber => $row->{randomNumber} };
+            }
+            else {
+                push @response,
+                  { id => $id, randomNumber => $row->{randomNumber} };
+            }
         }
     }
     return \@response;