fix: empty error messages for disabled openapi and /invalid/nested/paths
This commit is contained in:
@@ -3,8 +3,9 @@ module Feature.OpenApi.DisabledOpenApiSpec where
|
||||
import Network.HTTP.Types
|
||||
import Network.Wai (Application)
|
||||
|
||||
import Test.Hspec hiding (pendingWith)
|
||||
import Test.Hspec
|
||||
import Test.Hspec.Wai
|
||||
import Test.Hspec.Wai.JSON
|
||||
|
||||
import Protolude
|
||||
|
||||
@@ -13,4 +14,7 @@ spec =
|
||||
describe "Disabled OpenApi" $ do
|
||||
it "responds with 404" $
|
||||
request methodGet "/"
|
||||
[("Accept","application/openapi+json")] "" `shouldRespondWith` 404
|
||||
[("Accept","application/openapi+json")] ""
|
||||
`shouldRespondWith`
|
||||
[json| {"code":"PGRST126","details":null,"hint":null,"message":"Root endpoint metadata is disabled"} |]
|
||||
{ matchStatus = 404 }
|
||||
|
||||
@@ -1625,3 +1625,10 @@ spec = do
|
||||
get "/infinite_recursion?select=*" `shouldRespondWith`
|
||||
[json|{"code":"42P17","message":"infinite recursion detected in rules for relation \"infinite_recursion\"","details":null,"hint":null}|]
|
||||
{ matchStatus = 500 }
|
||||
|
||||
context "invalid resource path" $ do
|
||||
it "return http status 404" $
|
||||
get "/first/second/third?select=*"
|
||||
`shouldRespondWith`
|
||||
[json| {"code":"PGRST125","details":null,"hint":null,"message":"Invalid path specified in request URL"} |]
|
||||
{ matchStatus = 404 }
|
||||
|
||||
Reference in New Issue
Block a user