From c9cae2c86452ad1f705832ace88b8d0bad888722 Mon Sep 17 00:00:00 2001 From: Edsko de Vries Date: Sun, 16 Dec 2018 16:22:58 +0100 Subject: [PATCH] Accept content type without character set See https://github.com/haskell-servant/servant/issues/1097 for details. --- src/Servant/HTML/Blaze.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Servant/HTML/Blaze.hs b/src/Servant/HTML/Blaze.hs index 4e990c0..548a9e9 100644 --- a/src/Servant/HTML/Blaze.hs +++ b/src/Servant/HTML/Blaze.hs @@ -19,12 +19,15 @@ import qualified Network.HTTP.Media as M import Servant.API (Accept (..), MimeRender (..)) import Text.Blaze.Html (Html, ToMarkup, toHtml) import Text.Blaze.Html.Renderer.Utf8 (renderHtml) +import qualified Data.List.NonEmpty as NE data HTML deriving Typeable -- | @text/html;charset=utf-8@ instance Accept HTML where - contentType _ = "text" M.// "html" M./: ("charset", "utf-8") + contentTypes _ = + "text" M.// "html" M./: ("charset", "utf-8") NE.:| + ["text" M.// "html"] instance ToMarkup a => MimeRender HTML a where mimeRender _ = renderHtml . toHtml