Get rid of unneeded Maybe in NormalRequestResult (#34)

This commit is contained in:
Connor Clark 2016-06-23 14:34:36 -07:00 committed by Joel Stanley
parent 51891bb026
commit 9f170be5b0
2 changed files with 5 additions and 12 deletions

View file

@ -113,7 +113,7 @@ withClientCall client regmethod timeout f = do
data NormalRequestResult = NormalRequestResult
{ rspBody :: ByteString
, initMD :: Maybe MetadataMap -- initial metadata
, initMD :: MetadataMap -- initial metadata
, trailMD :: MetadataMap -- trailing metadata
, rspCode :: C.StatusCode
, details :: StatusDetails
@ -127,14 +127,7 @@ compileNormalRequestResults
[OpRecvInitialMetadataResult m,
OpRecvMessageResult (Just body),
OpRecvStatusOnClientResult m2 status details]
= Right $ NormalRequestResult body (Just m) m2 status
(StatusDetails details)
-- TODO: it seems registered request responses on the server
-- don't send initial metadata. Hence the 'Maybe'. Investigate.
compileNormalRequestResults
[OpRecvMessageResult (Just body),
OpRecvStatusOnClientResult m2 status details]
= Right $ NormalRequestResult body Nothing m2 status (StatusDetails details)
= Right $ NormalRequestResult body m m2 status (StatusDetails details)
compileNormalRequestResults x =
case extractStatusInfo x of
Nothing -> Left GRPCIOUnknownError

View file

@ -87,7 +87,7 @@ testMixRegisteredUnregistered =
clientRequest c rm1 1 "Hello" mempty >>= do
checkReqRslt $ \NormalRequestResult{..} -> do
rspBody @?= "reply test"
initMD @?= Just dummyMeta
initMD @?= dummyMeta
trailMD @?= dummyMeta
clientRequest c rm2 1 "bad endpoint" mempty >>= do
checkReqRslt $ \NormalRequestResult{..} -> do
@ -127,7 +127,7 @@ testPayload =
rspCode @?= StatusOk
rspBody @?= "reply test"
details @?= "details string"
initMD @?= Just dummyMeta
initMD @?= dummyMeta
trailMD @?= dummyMeta
server s = do
length (registeredMethods s) @?= 1
@ -286,7 +286,7 @@ testClientServerCompression =
rspCode @?= StatusOk
rspBody @?= "hello"
details @?= ""
initMD @?= Just dummyMeta
initMD @?= dummyMeta
trailMD @?= dummyMeta
return ()
sconf = ServerConfig "localhost"