{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-} {-| Module : Servant.XML.Conduit Description : Servant bindings for XML using xml-conduit Copyright : (c) CNRS, 2023-present License : AGPL + CECILL v3 Maintainer : team@gargantext.org Stability : experimental Portability : POSIX -} module Servant.XML.Conduit where import Data.Bifunctor (first) import Network.HTTP.Media qualified as M import Servant.API import Text.XML qualified as XML data XML instance Accept XML where contentType _ = "application" M.// "xml" M./: ("charset", "utf-8") instance {-# OVERLAPPING #-} MimeUnrender XML XML.Document where mimeUnrender _ bs = first show $ XML.parseLBS XML.def bs instance MimeRender XML XML.Document where mimeRender _ doc = XML.renderLBS XML.def doc