fix: Using GET with certain Content-Type headers now correctly calls the no parameter function if it exists

Using GET with text/plain or application/octet-stream as Content-Type headers no longer returns 404 Not Found when a function with no parameters exists
This commit is contained in:
Laurence Isla
2022-06-03 22:19:16 -05:00
committed by Steve Chavez
parent dd8a2c8979
commit ebc26d0c09
3 changed files with 13 additions and 1 deletions
+10
View File
@@ -1232,6 +1232,16 @@ spec actualPgVersion =
let respBody = simpleBody r
respBody `shouldBe` file
it "should call the function with no parameters and not fallback to the single unnamed parameter function when using GET with Content-Type headers" $ do
request methodGet "/rpc/overloaded_unnamed_param" [("Content-Type", "text/plain")] ""
`shouldRespondWith`
[json| 1|]
{ matchStatus = 200 }
request methodGet "/rpc/overloaded_unnamed_param" [("Content-Type", "application/octet-stream")] ""
`shouldRespondWith`
[json| 1|]
{ matchStatus = 200 }
it "should fail to fallback to any single unnamed parameter function when using an unsupported Content-Type header" $ do
request methodPost "/rpc/overloaded_unnamed_param"
[("Content-Type", "text/csv")]