Hello community,
here is the log from the commit of package ghc-yesod-core for openSUSE:Factory checked in at 2017-02-21 13:46:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-yesod-core (Old)
and /work/SRC/openSUSE:Factory/.ghc-yesod-core.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-yesod-core"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-yesod-core/ghc-yesod-core.changes 2017-02-03 17:40:39.427597549 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-yesod-core.new/ghc-yesod-core.changes 2017-02-21 13:46:10.247658930 +0100
@@ -1,0 +2,5 @@
+Sun Feb 5 19:31:39 UTC 2017 - psimons@suse.com
+
+- Update to version 1.4.31 with cabal2obs.
+
+-------------------------------------------------------------------
Old:
----
yesod-core-1.4.30.tar.gz
yesod-core.cabal
New:
----
yesod-core-1.4.31.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-yesod-core.spec ++++++
--- /var/tmp/diff_new_pack.FLg55k/_old 2017-02-21 13:46:10.691596301 +0100
+++ /var/tmp/diff_new_pack.FLg55k/_new 2017-02-21 13:46:10.695595736 +0100
@@ -19,14 +19,13 @@
%global pkg_name yesod-core
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 1.4.30
+Version: 1.4.31
Release: 0
Summary: Creation of type-safe, RESTful web applications
License: MIT
Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-aeson-devel
BuildRequires: ghc-auto-update-devel
@@ -105,7 +104,6 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
@@ -128,5 +126,6 @@
%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
+%doc ChangeLog.md README.md
%changelog
++++++ yesod-core-1.4.30.tar.gz -> yesod-core-1.4.31.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.30/ChangeLog.md new/yesod-core-1.4.31/ChangeLog.md
--- old/yesod-core-1.4.30/ChangeLog.md 2016-12-11 14:34:13.000000000 +0100
+++ new/yesod-core-1.4.31/ChangeLog.md 2017-02-02 06:52:44.000000000 +0100
@@ -1,3 +1,7 @@
+## 1.4.31
+
+* Add `parseCheckJsonBody` and `requireCheckJsonBody`
+
## 1.4.30
* Add `defaultMessageWidget`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.30/Yesod/Core/Json.hs new/yesod-core-1.4.31/Yesod/Core/Json.hs
--- old/yesod-core-1.4.30/Yesod/Core/Json.hs 2016-12-11 14:34:13.000000000 +0100
+++ new/yesod-core-1.4.31/Yesod/Core/Json.hs 2017-02-02 06:54:42.000000000 +0100
@@ -13,8 +13,10 @@
-- * Convert to a JSON value
, parseJsonBody
+ , parseCheckJsonBody
, parseJsonBody_
, requireJsonBody
+ , requireCheckJsonBody
-- * Produce JSON values
, J.Value (..)
@@ -33,7 +35,7 @@
, acceptsJson
) where
-import Yesod.Core.Handler (HandlerT, getRequest, invalidArgs, redirect, selectRep, provideRep, rawRequestBody, ProvidedRep)
+import Yesod.Core.Handler (HandlerT, getRequest, invalidArgs, redirect, selectRep, provideRep, rawRequestBody, ProvidedRep, lookupHeader)
import Control.Monad.Trans.Writer (Writer)
import Data.Monoid (Endo)
import Yesod.Core.Content (TypedContent)
@@ -121,6 +123,15 @@
Left e -> J.Error $ show e
Right value -> J.fromJSON value
+-- | Same as 'parseJsonBody', but ensures that the mime type indicates
+-- JSON content.
+parseCheckJsonBody :: (MonadHandler m, J.FromJSON a) => m (J.Result a)
+parseCheckJsonBody = do
+ mct <- lookupHeader "content-type"
+ case fmap (B8.takeWhile (/= ';')) mct of
+ Just "application/json" -> parseJsonBody
+ _ -> return $ J.Error $ "Non-JSON content type: " ++ show mct
+
-- | Same as 'parseJsonBody', but return an invalid args response on a parse
-- error.
parseJsonBody_ :: (MonadHandler m, J.FromJSON a) => m a
@@ -135,6 +146,15 @@
case ra of
J.Error s -> invalidArgs [pack s]
J.Success a -> return a
+
+-- | Same as 'requireJsonBody', but ensures that the mime type
+-- indicates JSON content.
+requireCheckJsonBody :: (MonadHandler m, J.FromJSON a) => m a
+requireCheckJsonBody = do
+ ra <- parseCheckJsonBody
+ case ra of
+ J.Error s -> invalidArgs [pack s]
+ J.Success a -> return a
-- | Convert a list of values to an 'J.Array'.
array :: J.ToJSON a => [a] -> J.Value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.30/Yesod/Core.hs new/yesod-core-1.4.31/Yesod/Core.hs
--- old/yesod-core-1.4.30/Yesod/Core.hs 2016-12-11 14:34:13.000000000 +0100
+++ new/yesod-core-1.4.31/Yesod/Core.hs 2017-01-19 14:53:56.000000000 +0100
@@ -18,7 +18,7 @@
, Approot (..)
, FileUpload (..)
, ErrorResponse (..)
- -- * Utitlities
+ -- * Utilities
, maybeAuthorized
, widgetToPageContent
-- * Defaults
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.30/Yesod/Routes/TH/RenderRoute.hs new/yesod-core-1.4.31/Yesod/Routes/TH/RenderRoute.hs
--- old/yesod-core-1.4.30/Yesod/Routes/TH/RenderRoute.hs 2016-12-11 14:34:13.000000000 +0100
+++ new/yesod-core-1.4.31/Yesod/Routes/TH/RenderRoute.hs 2017-01-08 23:10:45.000000000 +0100
@@ -46,7 +46,9 @@
mkRouteCon (ResourceParent name _check pieces children) = do
(cons, decs) <- mkRouteCons children
-#if MIN_VERSION_template_haskell(2,11,0)
+#if MIN_VERSION_template_haskell(2,12,0)
+ dec <- DataD [] (mkName name) [] Nothing cons <$> fmap (pure . DerivClause Nothing) (mapM conT [''Show, ''Read, ''Eq])
+#elif MIN_VERSION_template_haskell(2,11,0)
dec <- DataD [] (mkName name) [] Nothing cons <$> mapM conT [''Show, ''Read, ''Eq]
#else
let dec = DataD [] (mkName name) [] cons [''Show, ''Read, ''Eq]
@@ -153,7 +155,9 @@
mkRenderRouteInstance' cxt typ ress = do
cls <- mkRenderRouteClauses ress
(cons, decs) <- mkRouteCons ress
-#if MIN_VERSION_template_haskell(2,11,0)
+#if MIN_VERSION_template_haskell(2,12,0)
+ did <- DataInstD [] ''Route [typ] Nothing cons <$> fmap (pure . DerivClause Nothing) (mapM conT clazzes)
+#elif MIN_VERSION_template_haskell(2,11,0)
did <- DataInstD [] ''Route [typ] Nothing cons <$> mapM conT clazzes
#else
let did = DataInstD [] ''Route [typ] cons clazzes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.30/yesod-core.cabal new/yesod-core-1.4.31/yesod-core.cabal
--- old/yesod-core-1.4.30/yesod-core.cabal 2016-12-11 14:34:13.000000000 +0100
+++ new/yesod-core-1.4.31/yesod-core.cabal 2017-02-03 06:23:23.000000000 +0100
@@ -1,5 +1,5 @@
name: yesod-core
-version: 1.4.30
+version: 1.4.31
license: MIT
license-file: LICENSE
author: Michael Snoyman