Implements query counting in proc call and adds Content-Rage to response

headers in /rpc calls.
This commit is contained in:
Diogo Biazus
2016-02-26 14:51:35 -05:00
parent 4496a95014
commit 9d0f3573c6
4 changed files with 135 additions and 20 deletions
+9 -2
View File
@@ -372,8 +372,15 @@ spec = do
describe "remote procedure call" $ do
context "a proc that returns a set" $ do
it "returns paginated results" $
request methodPost "/rpc/getitemrange" (rangeHdrs (ByteRangeFromTo 0 0)) [json| { "min": 2, "max": 4 } |] `shouldRespondWith`
[json| [ {"id": 3} ] |]
request methodPost "/rpc/getitemrange"
(rangeHdrs (ByteRangeFromTo 0 0)) [json| { "min": 2, "max": 4 } |]
`shouldRespondWith` ResponseMatcher {
matchBody = Just [json| [{"id":3}] |]
, matchStatus = 206
, matchHeaders = ["Content-Range" <:> "0-0/2"]
}
it "returns proper json" $
post "/rpc/getitemrange" [json| { "min": 2, "max": 4 } |] `shouldRespondWith`
[json| [ {"id": 3}, {"id":4} ] |]