Handle request/response bodies with empty titles

This commit is contained in:
Ivan Lazar Miljenovic 2017-10-06 13:19:04 +11:00
parent a21beadf86
commit ed3ace3066

View file

@ -719,11 +719,15 @@ markdownWith RenderingOptions{..} api = unlines $
formatBody :: (Text, NonEmpty M.MediaType, ByteString) -> [String]
formatBody (t, ms, b) =
"- " <> cs t <> " (" <> mediaList ms <> "):" :
"- " <> title <> " (" <> mediaList ms <> "):" :
contentStr (NE.head ms) b
where
mediaList = fold . NE.intersperse ", " . fmap (\m -> "`" ++ show m ++ "`")
title
| T.null t = "Example"
| otherwise = cs t
markdownForType mime_type =
case (M.mainType mime_type, M.subType mime_type) of
("text", "html") -> "html"