summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmain.hs11
-rw-r--r--test.http5
2 files changed, 13 insertions, 3 deletions
diff --git a/main.hs b/main.hs
index 6d785c1..59c0b50 100755
--- a/main.hs
+++ b/main.hs
@@ -101,10 +101,15 @@ getQueryR :: Handler RepJson
getQueryR = do
qm <- lookupGetParam "number"
case qm of
- Nothing ->
- sendStatusJSON status400 $ (ApiError "Invalid request. Could not parse 'number' parameter.")
+ Nothing -> do
+ app <- getYesod
+ let db = appState app
+ callers <- liftIO $ query db (ViewCallers 20)
+ sendStatusJSON status400 $ callers
- Just q ->
+ Just q -> do
+ app <- getYesod
+ let db = appState app
sendStatusJSON status200 $ object [ "msg" .= ("FIXME" :: Text) ]
diff --git a/test.http b/test.http
index 5827247..5425f9a 100644
--- a/test.http
+++ b/test.http
@@ -16,6 +16,11 @@ Content-Type: application/x-www-form-urlencoded
GET :host/query?number=%2B15556789090
:headers
+# should return all entries
+GET :host/query
+:headers
+
+
# should return 200
POST :host/number
:headers