Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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