drop: Prefer: params=multiple-objects on RPC
BREAKING CHANGE A function with a JSON array or object parameter should be used instead
This commit is contained in:
committed by
Steve Chavez
parent
1442e02f5f
commit
bc1fb67df0
@@ -15,7 +15,6 @@ import Network.HTTP.Types
|
||||
import Test.Hspec hiding (pendingWith)
|
||||
import Test.Hspec.Wai
|
||||
import Test.Hspec.Wai.JSON
|
||||
import Text.Heredoc
|
||||
|
||||
import PostgREST.Config.PgVersion (PgVersion, pgVersion120,
|
||||
pgVersion130)
|
||||
@@ -331,21 +330,6 @@ spec actualPgVersion = do
|
||||
|
||||
liftIO $ planCost r `shouldSatisfy` (< 1.18)
|
||||
|
||||
context "params=multiple-objects" $ do
|
||||
it "should not exceed cost when calling setof composite proc" $ do
|
||||
r <- request methodPost "/rpc/get_projects_below"
|
||||
[planHdr, ("Prefer", "params=multiple-objects")]
|
||||
[str| [{"id": 1}, {"id": 4}] |]
|
||||
|
||||
liftIO $ planCost r `shouldSatisfy` (< 4503.4)
|
||||
|
||||
it "should not exceed cost when calling scalar proc" $ do
|
||||
r <- request methodPost "/rpc/add_them"
|
||||
[planHdr, ("Prefer", "params=multiple-objects")]
|
||||
[str| [{"a": 3, "b": 4}, {"a": 1, "b": 2}, {"a": 8, "b": 7}] |]
|
||||
|
||||
liftIO $ planCost r `shouldSatisfy` (< 5.85)
|
||||
|
||||
context "function inlining" $ do
|
||||
it "should inline a zero argument function(the function won't appear in the plan tree)" $ do
|
||||
r <- request methodGet "/rpc/getallusers?id=eq.1"
|
||||
|
||||
@@ -930,42 +930,6 @@ spec actualPgVersion =
|
||||
`shouldRespondWith` "3"
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
context "bulk RPC with params=multiple-objects" $ do
|
||||
it "works with a scalar function an returns a json array" $
|
||||
request methodPost "/rpc/add_them" [("Prefer", "params=multiple-objects")]
|
||||
[json|[
|
||||
{"a": 1, "b": 2},
|
||||
{"a": 4, "b": 6},
|
||||
{"a": 100, "b": 200} ]|]
|
||||
`shouldRespondWith`
|
||||
[json|
|
||||
[3, 10, 300]
|
||||
|] { matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
it "works with a scalar function an returns a json array when posting CSV" $
|
||||
request methodPost "/rpc/add_them" [("Content-Type", "text/csv"), ("Prefer", "params=multiple-objects")]
|
||||
"a,b\n1,2\n4,6\n100,200"
|
||||
`shouldRespondWith`
|
||||
[json|
|
||||
[3, 10, 300]
|
||||
|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "works with a non-scalar result" $
|
||||
request methodPost "/rpc/get_projects_below?select=id,name" [("Prefer", "params=multiple-objects")]
|
||||
[json|[
|
||||
{"id": 1},
|
||||
{"id": 5} ]|]
|
||||
`shouldRespondWith`
|
||||
[json|
|
||||
[{"id":1,"name":"Windows 7"},
|
||||
{"id":2,"name":"Windows 10"},
|
||||
{"id":3,"name":"IOS"},
|
||||
{"id":4,"name":"OSX"}]
|
||||
|] { matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
context "HTTP request env vars" $ do
|
||||
it "custom header is set" $
|
||||
request methodPost "/rpc/get_guc_value"
|
||||
|
||||
Reference in New Issue
Block a user