Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created May 20, 2015 12:55
Show Gist options
  • Select an option

  • Save codedmart/ec9237938342479e344d to your computer and use it in GitHub Desktop.

Select an option

Save codedmart/ec9237938342479e344d to your computer and use it in GitHub Desktop.
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