Simon Elliott 12 жил өмнө
parent
commit
6b6073615c
1 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 3 3
      web-simple/app.pl

+ 3 - 3
web-simple/app.pl

@@ -19,11 +19,11 @@ sub dispatch_request {
         my $id = int rand 10000 + 1;
         $sth->execute($id);
         if ( my $row = $sth->fetchrow_hashref ) {
-            push @response,
-              { id => $id, randomNumber => $row->{randomNumber} };
+            push @response, { id => $id, randomNumber => $row->{randomNumber} };
         }
     }
-    [ 200, \@response ];
+    [ 200, [ 'Content-type' => 'application/json; charset=utf-8', ],
+      [ encode_json(\@response)] ];
   }
 }