Efficiently include count and limit range responses

This commit is contained in:
Joe Nelson
2014-08-04 21:25:40 -07:00
parent eb126ab49f
commit 351b44ed52
2 changed files with 19 additions and 13 deletions
+6 -1
View File
@@ -88,7 +88,12 @@ app config req respond = do
respondWithRangedResult :: RangedResult -> Response
respondWithRangedResult rr =
responseLBS status206 [json, ("Content-Range", "*/" <> (BS.pack . show . rrTotal) rr)] (rrBody rr)
responseLBS status206 [
json,
("Content-Range",
"0-" <> (BS.pack . show . rrTo) rr <> "/"
<> (BS.pack . show . rrTotal) rr)
] (rrBody rr)
where
json = (hContentType, "application/json")