diff --git a/.travis.yml b/.travis.yml index 8774dc1..584bb87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,7 @@ install: - rm -fv cabal.project cabal.project.local - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - "printf 'packages: \".\"\\n' > cabal.project" + - "printf 'write-ghc-environment-files: always\\n' >> cabal.project" - touch cabal.project.local - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant-blaze | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" - cat cabal.project || true @@ -97,6 +98,7 @@ script: - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - "printf 'packages: servant-blaze-*/*.cabal\\n' > cabal.project" + - "printf 'write-ghc-environment-files: always\\n' >> cabal.project" - touch cabal.project.local - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant-blaze | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" - cat cabal.project || true @@ -120,15 +122,6 @@ script: # Constraint sets - rm -rf cabal.project.local - # Constraint set servant-0.7 - - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80000 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.7.*' all; else echo skipping...; fi - - # Constraint set servant-0.8 - - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80200 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.8.*' all; else echo skipping...; fi - - # Constraint set servant-0.9 - - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80200 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.9.*' all; else echo skipping...; fi - # Constraint set servant-0.10 - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80200 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.10.*' all; else echo skipping...; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index ba856e5..a945f04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.9 + +- Also accept content type without character set i.e `text/html` + # 0.8 - Only single `MimeRender HTML a` instance. `blaze-markup` has `ToMarkup Markup` instance. diff --git a/cabal.make-travis-yml b/cabal.make-travis-yml index a56581f..a1f3154 100644 --- a/cabal.make-travis-yml +++ b/cabal.make-travis-yml @@ -1,15 +1,3 @@ -constraint-set servant-0.7 - ghc: >= 7.8 && <8.0 - constraints: servant ==0.7.* - -constraint-set servant-0.8 - ghc: >= 7.8 && <8.2 - constraints: servant ==0.8.* - -constraint-set servant-0.9 - ghc: >= 7.8 && <8.2 - constraints: servant ==0.9.* - constraint-set servant-0.10 ghc: >= 7.8 && <8.2 constraints: servant ==0.10.* diff --git a/servant-blaze.cabal b/servant-blaze.cabal index 4b3aecb..63a30db 100644 --- a/servant-blaze.cabal +++ b/servant-blaze.cabal @@ -1,7 +1,6 @@ cabal-version: >=1.10 name: servant-blaze -version: 0.8 -x-revision: 2 +version: 0.9 synopsis: Blaze-html support for servant category: Servant, Web @@ -33,7 +32,7 @@ source-repository head library exposed-modules: Servant.HTML.Blaze build-depends: base >=4.7 && <5 - , servant >=0.7 && <0.16 + , servant >=0.10 && <0.16 , http-media >=0.6.4 && <0.8 , blaze-html >=0.9.0.1 && <0.10 hs-source-dirs: src 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