Created
May 20, 2015 12:55
-
-
Save codedmart/ec9237938342479e344d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type IsSecureApi = IsSecure :> Get '[JSON] Bool | |
| isSecureApi :: Proxy IsSecureApi | |
| isSecureApi = Proxy | |
| isSecureServer :: Server IsSecureApi | |
| isSecureServer = isSecureDel | |
| where isSecureDel x = case x of | |
| True -> return True | |
| _ -> return False | |
| isSecureSpec :: Spec | |
| isSecureSpec = do | |
| describe "Servant.API.IsSecure" $ do | |
| it "is secure route" $ | |
| (flip runSession) (serve isSecureApi isSecureServer) $ do | |
| response1 <- Network.Wai.Test.request defaultRequest { | |
| isSecure = True | |
| } | |
| liftIO $ do | |
| decode' (simpleBody response1) `shouldBe` Just True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment