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 1d54be3 commit 44cbcdf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Servant/HTML/Lucid.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
-- Will then check that @a@ has a `ToHtml` instance, or is `Html`.
module Servant.HTML.Lucid where

import qualified Data.List.NonEmpty as NE
import Data.Typeable (Typeable)
import Lucid (ToHtml (..), renderBS)
import qualified Network.HTTP.Media as M
Expand All @@ -23,7 +24,9 @@ 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 ToHtml a => MimeRender HTML a where
mimeRender _ = renderBS . toHtml

0 comments on commit 44cbcdf

Please sign in to comment.