fix: aggregates not working for all schemas

Closes https://github.com/PostgREST/postgrest/issues/3124
This commit is contained in:
steve-chavez
2023-12-20 15:20:18 -05:00
committed by Steve Chavez
parent 0b77098460
commit 1680a6eed3
5 changed files with 74 additions and 3 deletions
@@ -150,6 +150,20 @@ spec =
matchStatus = 406
}
it "succeeds in calling handler with a domain on another schema" $
request methodGet "/another_table" [("Accept-Profile", "v2"), (hAccept, "text/plain")] ""
`shouldRespondWith` "plain"
{ matchStatus = 200
, matchHeaders = ["Content-Type" <:> "text/plain; charset=utf-8", "Content-Profile" <:> "v2"]
}
it "succeeds in calling handler with a domain on an exposed schema" $
request methodGet "/another_table" [("Accept-Profile", "v2"), (hAccept, "text/special")] ""
`shouldRespondWith` "special"
{ matchStatus = 200
, matchHeaders = ["Content-Type" <:> "text/special", "Content-Profile" <:> "v2"]
}
context "calling procs on different schemas" $ do
it "succeeds in calling the default schema proc" $
request methodGet "/rpc/get_parents_below?id=6" [] ""
@@ -194,6 +208,20 @@ spec =
, matchHeaders = [matchContentTypeJson, "Content-Profile" <:> "v2"]
}
it "succeeds in calling handler with a domain on another schema" $
request methodGet "/rpc/get_plain_text" [("Accept-Profile", "v2"), (hAccept, "text/plain")] ""
`shouldRespondWith` "plain"
{ matchStatus = 200
, matchHeaders = ["Content-Type" <:> "text/plain; charset=utf-8", "Content-Profile" <:> "v2"]
}
it "succeeds in calling handler with a domain on an exposed schema" $
request methodGet "/rpc/get_special_text" [("Accept-Profile", "v2"), (hAccept, "text/special")] ""
`shouldRespondWith` "special"
{ matchStatus = 200
, matchHeaders = ["Content-Type" <:> "text/special", "Content-Profile" <:> "v2"]
}
context "Modifying tables on different schemas" $ do
it "succeeds in patching on the v1 schema and returning its parent" $
request methodPatch "/children?select=name,parent(name)&id=eq.1" [("Content-Profile", "v1"), ("Prefer", "return=representation")]