Fix empty results

This commit is contained in:
Joe Nelson
2014-12-06 17:42:18 -08:00
parent 1b8f0f2829
commit f7e0386d1c
+2 -2
View File
@@ -62,7 +62,7 @@ app conn req respond =
) )
row <- listToMaybe <$> uncurry (query conn) select row <- listToMaybe <$> uncurry (query conn) select
let (tableTotal, queryTotal, body) = let (tableTotal, queryTotal, body) =
fromMaybe (0, 0, "" :: ByteString) row fromMaybe (0, 0, Just "" :: Maybe ByteString) row
from = fromMaybe 0 $ rangeOffset <$> range from = fromMaybe 0 $ rangeOffset <$> range
to = from+queryTotal to = from+queryTotal
contentRange = contentRangeH from to tableTotal contentRange = contentRangeH from to tableTotal
@@ -78,7 +78,7 @@ app conn req respond =
"/" <> cs table <> "/" <> cs table <>
if Prelude.null canonical then "" else "?" <> cs canonical if Prelude.null canonical then "" else "?" <> cs canonical
) )
] (cs body) ] (cs $ fromMaybe "[]" body)
(["dbapi", "users"], "POST") -> do (["dbapi", "users"], "POST") -> do
body <- strictRequestBody req body <- strictRequestBody req