fix: wrong subquery error returning as 400 status
This commit is contained in:
committed by
Steve Chavez
parent
bbc0bda6f5
commit
45cabacdcc
@@ -9,8 +9,8 @@ import Test.Hspec.Wai.JSON
|
||||
|
||||
import Protolude hiding (get)
|
||||
|
||||
spec :: SpecWith ((), Application)
|
||||
spec = do
|
||||
nonExistentSchema :: SpecWith ((), Application)
|
||||
nonExistentSchema = do
|
||||
describe "Non existent api schema" $ do
|
||||
it "succeeds when requesting root path" $
|
||||
get "/" `shouldRespondWith` 200
|
||||
@@ -61,3 +61,9 @@ spec = do
|
||||
"code": "PGRST117",
|
||||
"message":"Unsupported HTTP method: OTHER"}|]
|
||||
{ matchStatus = 405 }
|
||||
|
||||
pgErrorCodeMapping :: SpecWith ((), Application)
|
||||
pgErrorCodeMapping = do
|
||||
describe "PostreSQL error code mappings" $ do
|
||||
it "should return 500 for cardinality_violation" $
|
||||
get "/bad_subquery" `shouldRespondWith` 500
|
||||
|
||||
+2
-1
@@ -152,6 +152,7 @@ main = do
|
||||
, ("Feature.Query.RelatedQueriesSpec" , Feature.Query.RelatedQueriesSpec.spec)
|
||||
, ("Feature.Query.SpreadQueriesSpec" , Feature.Query.SpreadQueriesSpec.spec)
|
||||
, ("Feature.NoSuperuserSpec" , Feature.NoSuperuserSpec.spec)
|
||||
, ("Feature.Query.PgErrorCodeMappingSpec" , Feature.Query.ErrorSpec.pgErrorCodeMapping)
|
||||
]
|
||||
|
||||
hspec $ do
|
||||
@@ -211,7 +212,7 @@ main = do
|
||||
|
||||
-- this test runs with a nonexistent db-schema
|
||||
parallel $ before nonexistentSchemaApp $
|
||||
describe "Feature.Query.ErrorSpec" Feature.Query.ErrorSpec.spec
|
||||
describe "Feature.Query.NonExistentSchemaErrorSpec" Feature.Query.ErrorSpec.nonExistentSchema
|
||||
|
||||
-- this test runs with an extra search path
|
||||
parallel $ before extraSearchPathApp $ do
|
||||
|
||||
Vendored
+3
@@ -3752,3 +3752,6 @@ create aggregate test.some_agg (some_numbers) (
|
||||
, sfunc = some_trans
|
||||
, finalfunc = some_final
|
||||
);
|
||||
|
||||
create view bad_subquery as
|
||||
select * from projects where id = (select id from projects);
|
||||
|
||||
Reference in New Issue
Block a user