don't worry about length of response status code

This commit is contained in:
Jonathan Lamothe 2021-11-25 03:26:36 -05:00
parent 14f2064050
commit 465b5a9115

View File

@ -147,14 +147,11 @@ unescapeString str = case decodeUtf8' $ BS.pack $ toBytes str of
encodeGemResponse :: GemResponse -> BSL.ByteString encodeGemResponse :: GemResponse -> BSL.ByteString
encodeGemResponse resp = let encodeGemResponse resp = let
code = respStatus resp code = respStatus resp
high = code `div` 10
low = code `mod` 10
meta = respMeta resp meta = respMeta resp
body = fromMaybe "" $ respBody resp body = fromMaybe "" $ respBody resp
builder builder
= word8Dec high = word8Dec code
<> word8Dec low
<> charUtf8 ' ' <> charUtf8 ' '
<> stringUtf8 meta <> stringUtf8 meta
<> stringUtf8 "\r\n" <> stringUtf8 "\r\n"