From 84dd08d1bf97b4a6175af8a0dd56c653206f84be Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Thu, 25 Nov 2021 14:21:33 +0100 Subject: [PATCH] Return correct status messages in HTTP2 client The `Enum` instance of `Status` can be used to create values containing the usual values for the message. This replaces the hardcoded "fixme" value that was previously returned as part of the status. --- Network/HTTP2/Arch/Status.hs | 2 +- test/HTTP2/ServerSpec.hs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Network/HTTP2/Arch/Status.hs b/Network/HTTP2/Arch/Status.hs index e894a1c8..5b6793c5 100644 --- a/Network/HTTP2/Arch/Status.hs +++ b/Network/HTTP2/Arch/Status.hs @@ -41,4 +41,4 @@ fromStatus status = unsafeCreate 3 $ \p -> do toStatus :: ByteString -> Maybe H.Status toStatus bs = case C8.readInt bs of Nothing -> Nothing - Just (code,_) -> Just $ H.mkStatus code "fixme" + Just (code,_) -> Just $ toEnum code diff --git a/test/HTTP2/ServerSpec.hs b/test/HTTP2/ServerSpec.hs index e97c430f..3d4ceec2 100644 --- a/test/HTTP2/ServerSpec.hs +++ b/test/HTTP2/ServerSpec.hs @@ -116,6 +116,7 @@ client0 sendRequest = do let req = C.requestNoBody methodGet "/" [] sendRequest req $ \rsp -> do C.responseStatus rsp `shouldBe` Just ok200 + fmap statusMessage (C.responseStatus rsp) `shouldBe` Just "OK" client1 :: C.Client () client1 sendRequest = do