fix: empty row on handler function
Closes https://github.com/PostgREST/postgrest/issues/3126
This commit is contained in:
committed by
Steve Chavez
parent
1680a6eed3
commit
3af63cb94c
@@ -119,6 +119,13 @@ spec = describe "custom media types" $ do
|
||||
, matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"]
|
||||
}
|
||||
|
||||
it "should not fail when the function doesn't return a row" $ do
|
||||
request methodGet "/rpc/get_line?id=777" (acceptHdrs "application/vnd.twkb") ""
|
||||
`shouldRespondWith` ""
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = ["Content-Type" <:> "application/vnd.twkb"]
|
||||
}
|
||||
|
||||
context "Proc that returns scalar based on a table" $ do
|
||||
it "can get an image with Accept: image/png" $ do
|
||||
r <- request methodGet "/rpc/ret_image" (acceptHdrs "image/png") ""
|
||||
|
||||
Vendored
+5
@@ -3517,6 +3517,11 @@ returns setof test.lines as $$
|
||||
select * from lines;
|
||||
$$ language sql;
|
||||
|
||||
create or replace function test.get_line (id int)
|
||||
returns "application/vnd.twkb" as $$
|
||||
select extensions.st_astwkb(geom)::"application/vnd.twkb" from lines where id = get_line.id;
|
||||
$$ language sql;
|
||||
|
||||
create or replace function test.get_shop_bles ()
|
||||
returns setof test.shop_bles as $$
|
||||
select * from shop_bles;
|
||||
|
||||
Reference in New Issue
Block a user