-
Couldn't load subscription status.
- Fork 14
Open
Labels
Description
Full reproduction: https://github.com/bergmark/sce
Using servant-0.13.1 and servant-checked-exceptions-2.0.0.0
data BadReq = BadReq deriving Show
deriveJSON defaultOptions ''BadReq
instance ErrStatus BadReq where toErrStatus BadReq = badRequest400
type API = Throws BadReq :> Get '[JSON] Value
api :: Proxy API
api = Proxy
server :: Server API
server = pureErrEnvelope BadReq
main :: IO ()
main = do
tid <- forkIO (run 8080 $ serve api server)
manager' <- newManager defaultManagerSettings
print =<< runClientM (client api) (mkClientEnv manager' (BaseUrl Http "localhost" 8080 ""))
killThread tidI expected this to print the Error envelope but instead I get
Left (FailureResponse (Response {responseStatusCode = Status {statusCode = 400, statusMessage = "Bad Request"}, responseHeaders = fromList [("Transfer-Encoding","chunked"),("Date","Sun, 15 Jul 2018 17:53:24 GMT"),("Server","Warp/3.2.22"),("Content-Type","application/json;charset=utf-8")], responseHttpVersion = HTTP/1.1, responseBody = "{\"err\":[]}"}))If i change the ErrStatus instance to return ok200 I get the envelope as expected:
Right (ErrEnvelope (Identity BadReq))Is there something I'm missing?