fix: Return 406 instead of 415 for non-acceptable media type

415 is for Content-Type and 406 for Accept headers.
This commit is contained in:
Wolfgang Walther
2024-02-15 19:01:12 +01:00
parent 3432f75ed4
commit 2466f4e738
8 changed files with 19 additions and 18 deletions
+4 -4
View File
@@ -30,15 +30,15 @@ spec actualPgVersion = describe "OpenAPI" $ do
, matchHeaders = ["Content-Type" <:> "application/openapi+json; charset=utf-8"]
}
it "should respond to openapi request on none root path with 415" $
it "should respond to openapi request on none root path with 406" $
request methodGet "/items"
(acceptHdrs "application/openapi+json") ""
`shouldRespondWith` 415
`shouldRespondWith` 406
it "should respond to openapi request with unsupported media type with 415" $
it "should respond to openapi request with unsupported media type with 406" $
request methodGet "/"
(acceptHdrs "text/csv") ""
`shouldRespondWith` 415
`shouldRespondWith` 406
it "includes postgrest.org current version api docs" $ do
r <- simpleBody <$> get "/"