No count by default (#700)

* WIP: disable counting total table size by default

* Remove commented tests since PUT is no longer supported

* Fix tests for invalid range which require count

* Do not report count in PATCH response if not asked

* Return count of deleted items only if asked

* Return count for bulk insert when requested

* Changelog entry
This commit is contained in:
Joe Nelson
2016-09-04 10:31:24 -07:00
committed by GitHub
parent 7278507c42
commit af75988dd4
9 changed files with 100 additions and 150 deletions
+6 -6
View File
@@ -16,11 +16,11 @@ spec =
`shouldRespondWith` ResponseMatcher {
matchBody = Nothing
, matchStatus = 204
, matchHeaders = ["Content-Range" <:> "*/1"]
, matchHeaders = ["Content-Range" <:> "*/*"]
}
it "returns the deleted item" $
request methodDelete "/items?id=eq.2" [("Prefer", "return=representation")] ""
it "returns the deleted item and count if requested" $
request methodDelete "/items?id=eq.2" [("Prefer", "return=representation"), ("Prefer", "count=exact")] ""
`shouldRespondWith` ResponseMatcher {
matchBody = Just [str|[{"id":2}]|]
, matchStatus = 200
@@ -31,14 +31,14 @@ spec =
`shouldRespondWith` ResponseMatcher {
matchBody = Just [str|[{"id":2,"name":"Two"}]|]
, matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/1"]
, matchHeaders = ["Content-Range" <:> "*/*"]
}
it "can embed (parent) entities" $
request methodDelete "/tasks?id=eq.8&select=id,name,project{id}" [("Prefer", "return=representation")] ""
`shouldRespondWith` ResponseMatcher {
matchBody = Just [str|[{"id":8,"name":"Code OSX","project":{"id":4}}]|]
, matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/1"]
, matchHeaders = ["Content-Range" <:> "*/*"]
}
it "actually clears items ouf the db" $ do
@@ -47,7 +47,7 @@ spec =
`shouldRespondWith` ResponseMatcher {
matchBody = Just [str|[{"id":15}]|]
, matchStatus = 200
, matchHeaders = ["Content-Range" <:> "0-0/1"]
, matchHeaders = ["Content-Range" <:> "0-0/*"]
}
context "known route, unknown record" $