@@ -593,12 +593,14 @@ basicAuthSpec = do
593------------------------------------------------------------------------------
593------------------------------------------------------------------------------
595type GenAuthAPI = AuthProtect "auth" :> "auth" :> Get '[JSON] Animal
595type GenAuthAPI = AuthProtect "auth" :> "auth" :> Get '[JSON] Animal
597−authApi :: Proxy GenAuthAPI
598+genAuthApi :: Proxy GenAuthAPI
598−authApi = Proxy
599+genAuthApi = Proxy
600−authServer :: Server GenAuthAPI
601+genAuthServer :: Server GenAuthAPI
601−authServer = const (return tweety)
602+genAuthServer = const (return tweety)
603+ :<|> (\ _ respond -> respond $ responseLBS imATeaPot418 [] "")
603type instance AuthServerData (AuthProtect "auth") = ()
605type instance AuthServerData (AuthProtect "auth") = ()
@@ -614,7 +616,7 @@ genAuthContext =
614genAuthSpec :: Spec
616genAuthSpec :: Spec
615genAuthSpec = do
617genAuthSpec = do
616 describe "Servant.API.Auth" $ do
618 describe "Servant.API.Auth" $ do
617− with (return (serveWithContext authApi genAuthContext authServer)) $ do
619+ with (return (serveWithContext genAuthApi genAuthContext genAuthServer)) $ do
619 context "Custom Auth Protection" $ do
621 context "Custom Auth Protection" $ do
620 it "returns 401 when missing headers" $ do
622 it "returns 401 when missing headers" $ do
@@ -623,6 +625,9 @@ genAuthSpec = do
623 it "returns 200 with the right header" $ do
625 it "returns 200 with the right header" $ do
624 THW.request methodGet "/auth" [("Auth","secret")] "" `shouldRespondWith` 200
626 THW.request methodGet "/auth" [("Auth","secret")] "" `shouldRespondWith` 200
628+ it "plays nice with subsequent Raw endpoints" $ do
629+ get "/foo" `shouldRespondWith` 418
627------------------------------------------------------------------------------
632------------------------------------------------------------------------------
628-- * Test data types {{{
633-- * Test data types {{{