Created
May 20, 2015 12:25
-
-
Save codedmart/8f5e704171dd0d58b2e7 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
| -- servant-server/src/Servant/Server/Internal.hs | |
| -- | IsSecure | |
| instance (HasServer sublayout) => HasServer (IsSecure :> sublayout) where | |
| type ServerT (IsSecure :> sublayout) m = | |
| Bool -> ServerT sublayout m | |
| route Proxy subserver request respond = | |
| route (Proxy :: Proxy sublayout) (subserver $ isSecure request) request respond |
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
| -- servant/src/Servant/API/IsSecure.hs | |
| {-# LANGUAGE DeriveDataTypeable #-} | |
| {-# OPTIONS_HADDOCK not-home #-} | |
| module Servant.API.IsSecure (IsSecure) where | |
| import Data.Typeable (Typeable) | |
| -- | Lookup a isSecure from request. Was this request made over an SSL connection? | |
| -- Returns 'True' or 'False'. See http://hackage.haskell.org/package/wai-3.0.2.3/docs/Network-Wai.html#v:isSecure | |
| -- for more information | |
| -- | |
| -- Example: | |
| -- | |
| -- >>> | |
| -- >>> -- GET /is-secure | |
| -- >>> type MyApi = "is-secure" :> IsSecure :> Get '[JSON] () | |
| data IsSecure = True | False deriving Typeable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment