Browse Source

Add special route for single-query test with response not in a vector

Keith R. Gustafson 11 years ago
parent
commit
44de11bf57
1 changed files with 3 additions and 2 deletions
  1. 3 2
      http-kit/hello/src/hello/handler.clj

+ 3 - 2
http-kit/hello/src/hello/handler.clj

@@ -23,16 +23,17 @@
 
 ;; Run the specified number of queries, return the results
 (defn run-queries [queries]
-  (vec ; Return as a vector
    (flatten ; Make it a list of maps
     (take
      queries ; Number of queries to run
-     (repeatedly get-world)))))
+     (repeatedly get-world))))
 
 ;; Define route handlers
 (defroutes app-routes
   (GET "/http-kit/" [] "Hello, World!")
   (GET "/http-kit/json" [] (response {:message "Hello, World!"}))
+  (GET "/http-kit/db" []
+       (response (first (run-queries 1))))
   (GET "/http-kit/db/:queries" [queries]
        (response (run-queries (Integer/parseInt queries))))
   (route/not-found "Not Found"))