mirror of
https://github.com/ilyakooo0/servant-quickcheck.git
synced 2024-11-25 11:03:53 +03:00
32 lines
825 B
Haskell
32 lines
825 B
Haskell
{-# LANGUAGE OverloadedStrings, DataKinds #-}
|
|
module Main (main) where
|
|
|
|
import Servant
|
|
import Servant.QuickCheck
|
|
import Test.Hspec
|
|
import Data.Text (Text)
|
|
import System.Environment (getArgs)
|
|
|
|
main :: IO ()
|
|
main = do
|
|
args <- getArgs
|
|
case args of
|
|
[] -> putStrLn "Not running without arguments. Try --help or --fail-fast."
|
|
_ -> hspec spec
|
|
|
|
-- Change to String to reproduce
|
|
-- https://github.com/haskell-servant/servant-quickcheck/issues/41
|
|
type API = Get '[PlainText] Text
|
|
|
|
api :: Proxy API
|
|
api = Proxy
|
|
|
|
server :: Server API
|
|
server = return "Sigurð Fáfnirslayer"
|
|
|
|
spec :: Spec
|
|
spec = describe "example server" $
|
|
it "mangles UTF-8 in error messages" $
|
|
withServantServer api (return server) $ \burl ->
|
|
serverSatisfies api burl defaultArgs (getsHaveCacheControlHeader <%> mempty)
|