Skip to content

Commit

Permalink
Accept content type without character set
Browse files Browse the repository at this point in the history
  • Loading branch information
edsko committed Dec 16, 2018
1 parent 463b95c commit c9cae2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Servant/HTML/Blaze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c9cae2c

Please sign in to comment.