feat: add Content-Length response header

This commit is contained in:
Laurence Isla
2025-04-24 12:49:18 -05:00
committed by Steve Chavez
parent 98fcbedca5
commit 57ef9988a5
23 changed files with 298 additions and 114 deletions
+8 -4
View File
@@ -24,7 +24,8 @@ spec = describe "OpenAPI" $ do
`shouldRespondWith`
""
{ matchStatus = 200
, matchHeaders = ["Content-Type" <:> "application/openapi+json; charset=utf-8"]
, matchHeaders = [ "Content-Type" <:> "application/openapi+json; charset=utf-8"
, matchHeaderAbsent hContentLength ]
}
it "should respond to openapi request on none root path with 406" $
@@ -38,11 +39,14 @@ spec = describe "OpenAPI" $ do
`shouldRespondWith` 406
it "includes postgrest.org current version api docs" $ do
r <- simpleBody <$> get "/"
r <- get "/"
let docsUrl = r ^? key "externalDocs" . key "url"
let headers = simpleHeaders r
docsUrl = simpleBody r ^? key "externalDocs" . key "url"
liftIO $ docsUrl `shouldBe` Just (String ("https://postgrest.org/en/" <> docsVersion <> "/references/api.html"))
liftIO $ do
headers `shouldSatisfy` notZeroContentLength
docsUrl `shouldBe` Just (String ("https://postgrest.org/en/" <> docsVersion <> "/references/api.html"))
describe "schema" $ do