mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-10 13:19:41 +01:00
Get rid of unneeded Maybe in NormalRequestResult (#34)
This commit is contained in:
parent
51891bb026
commit
9f170be5b0
2 changed files with 5 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue