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
| type AuthTokenAPI = | |
| WithAuthToken :> ( | |
| "private" :> Get String | |
| :<|> "private" :> Post String | |
| ) | |
| api :: Proxy API | |
| api = Proxy | |
| authTokenServer :: Pool DBHandle -> Server AuthTokenAPI |
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
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveDataTypeable #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# OPTIONS_HADDOCK not-home #-} | |
| module Servant.API.Delete (Delete) where | |
| import Data.Typeable ( Typeable ) | |
| -- | Combinator for DELETE requests. | |
| -- |
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
| client returns errors appropriately | |
| reports FailureResponse FAILED [1] | |
| reports DecodeFailure FAILED [2] | |
| reports ConnectionError FAILED [3] | |
| reports UnsupportedContentType FAILED [4] | |
| reports InvalidContentTypeHeader | |
| Failures: | |
| 1) client returns errors appropriately reports FailureResponse |
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
| {-# LANGUAGE CPP #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE RecordWildCards #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# OPTIONS_GHC -fcontext-stack=100 #-} |
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
| test/Servant/ClientSpec.hs:286:12: | |
| Couldn't match type ‘Method | |
| -> EitherT | |
| ServantError | |
| IO | |
| (Int, ByteString, MediaType, [HTTP.Header], C.Response ByteString)’ | |
| with ‘EitherT ServantError IO Person’ | |
| Expected type: EitherT ServantError IO Person | |
| :<|> (EitherT ServantError IO () | |
| :<|> ((String -> EitherT ServantError IO Person) |
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
| it "Returns headers appropriately" $ hspec $ withServer $ \ host -> do | |
| res <- runIO $ runEitherT getRespHeaders | |
| case res of | |
| Left e -> runIO $ assertFailure $ show e | |
| Right val -> runIO $ getHeaders val `shouldBe` [("X-Example1", "1729"), ("X-Example2", "eg2")] | |
| modifyMaxSuccess (const 20) $ do | |
| it "works for a combination of Capture, QueryParam, QueryFlag and ReqBody" $ | |
| property $ forAllShrink pathGen shrink $ \(NonEmpty cap) num flag body -> | |
| ioProperty $ do |
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
| Failures: | |
| 1) client returns errors appropriately reports FailureResponse | |
| uncaught exception: IOException of type UserError (user error (Pattern match failure in do expression at test/Servant/ClientSpec.hs:274:7-14)) | |
| 2) client returns errors appropriately reports DecodeFailure | |
| uncaught exception: IOException of type UserError (user error (Pattern match failure in do expression at test/Servant/ClientSpec.hs:280:7-14)) | |
| 3) client returns errors appropriately reports ConnectionError | |
| uncaught exception: IOException of type UserError (user error (Pattern match failure in do expression at test/Servant/ClientSpec.hs:287:7-14)) |
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
| {-# LANGUAGE CPP #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE RecordWildCards #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# OPTIONS_GHC -fcontext-stack=25 #-} |
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
| {-# LANGUAGE CPP #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE RecordWildCards #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# OPTIONS_GHC -fcontext-stack=25 #-} |