From e3bf0447418665b08b290c909a750ac2e2c1845e Mon Sep 17 00:00:00 2001 From: Joachim Desroches Date: Fri, 24 Aug 2018 17:31:03 +0200 Subject: [PATCH] Add test for onlyJsonObjects when no content-type header is present. --- test/Servant/QuickCheck/InternalSpec.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/Servant/QuickCheck/InternalSpec.hs b/test/Servant/QuickCheck/InternalSpec.hs index 6d38cdd..216235e 100644 --- a/test/Servant/QuickCheck/InternalSpec.hs +++ b/test/Servant/QuickCheck/InternalSpec.hs @@ -133,6 +133,10 @@ onlyJsonObjectSpec = describe "onlyJsonObjects" $ do withServantServerAndContext octetAPI ctx serverOctetAPI $ \burl -> serverSatisfies octetAPI burl args (onlyJsonObjects <%> mempty) + it "does not fail when there is no content-type" $ do + withServantServerAndContext api2 ctx serverFailing $ \burl -> + serverSatisfies api2 burl args (onlyJsonObjects <%> mempty) + notLongerThanSpec :: Spec notLongerThanSpec = describe "notLongerThan" $ do @@ -274,6 +278,9 @@ server2 = return $ return 1 server3 :: IO (Server API2) server3 = return $ return 2 +serverFailing :: IO (Server API2) +serverFailing = return . throwError $ err405 + -- With Doctypes type HtmlDoctype = Get '[HTML] Blaze.Html