fix(users/Profpatsch/whatcd-resolver): always use good html renderer

The pretty renderer would add extra newlines, making the html
different.

Change-Id: I28496cbec61d4c9c63f657a499a1990f891949ee
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11639
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
Autosubmit: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-05-09 13:10:48 +02:00 committed by clbot
parent 58156967b8
commit 15054715d6

View file

@ -55,7 +55,6 @@ import System.Directory qualified as Xdg
import System.Environment qualified as Env
import System.FilePath ((</>))
import Text.Blaze.Html (Html)
import Text.Blaze.Html.Renderer.Pretty qualified as Html.Pretty
import Text.Blaze.Html.Renderer.Utf8 qualified as Html
import Text.Blaze.Html5 qualified as Html
import Tool (readTool, readTools)
@ -313,10 +312,6 @@ runHandlers ::
(Wai.Response -> IO ResponseReceived) ->
m ResponseReceived
runHandlers debug defaultHandler handlers req respond = withRunInIO $ \runInIO -> do
let renderHtml =
if debug
then Html.Pretty.renderHtml >>> stringToText >>> textToBytesUtf8 >>> toLazyBytes
else Html.renderHtml
let hh route act =
Otel.inSpan'
[fmt|Route {route}|]
@ -329,7 +324,7 @@ runHandlers debug defaultHandler handlers req respond = withRunInIO $ \runInIO -
)
( \span -> do
res <- act span
liftIO $ respond . Wai.responseLBS Http.ok200 ([("Content-Type", "text/html")] <> res.extraHeaders) . renderHtml $ res.html
liftIO $ respond . Wai.responseLBS Http.ok200 ([("Content-Type", "text/html")] <> res.extraHeaders) . Html.renderHtml $ res.html
)
let h route act = hh route (\span -> act span <&> (\html -> T2 (label @"html" html) (label @"extraHeaders" [])))