git.iko.soy/servant-quickcheck
on master help sign in
Add test for onlyJsonObjects when no content-type header is present.
commite3bf0447418665b08b290c909a750ac2e2c1845e authorJoachim Desroches <joachim.desroches@epfl.ch> dateFri 24 Aug 2018, 17:31 (8 years ago) parent35c9862
1 file changed+7
test/Servant/QuickCheck/InternalSpec.hs+7
test/Servant/QuickCheck/InternalSpec.hs+7
@@ -133,6 +133,10 @@ onlyJsonObjectSpec = describe "onlyJsonObjects" $ do
133133 withServantServerAndContext octetAPI ctx serverOctetAPI $ \burl ->
134134 serverSatisfies octetAPI burl args (onlyJsonObjects <%> mempty)
135135
136+ it "does not fail when there is no content-type" $ do
137+ withServantServerAndContext api2 ctx serverFailing $ \burl ->
138+ serverSatisfies api2 burl args (onlyJsonObjects <%> mempty)
139+
136140notLongerThanSpec :: Spec
137141notLongerThanSpec = describe "notLongerThan" $ do
138142
@@ -274,6 +278,9 @@ server2 = return $ return 1
274278server3 :: IO (Server API2)
275279server3 = return $ return 2
276280
281+serverFailing :: IO (Server API2)
282+serverFailing = return . throwError $ err405
283+
277284-- With Doctypes
278285type HtmlDoctype = Get '[HTML] Blaze.Html
279286