This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-core".
The branch, master has been updated
via 842b09db3cdfcf3116e214c472e664a0aee529a6 (commit)
from 0fa737d9fbabc14cefc59020722e4077a4d6760d (commit)
Summary of changes:
src/Snap/Internal/Types.hs | 11 +++++++++++
src/Snap/Types.hs | 1 +
2 files changed, 12 insertions(+), 0 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 842b09db3cdfcf3116e214c472e664a0aee529a6
Author: Gregory Collins <[email protected]>
Date: Sun Mar 27 11:40:16 2011 +0200
Add a 'methods' function to Snap.Types
diff --git a/src/Snap/Internal/Types.hs b/src/Snap/Internal/Types.hs
index 7430aaf..22b3755 100644
--- a/src/Snap/Internal/Types.hs
+++ b/src/Snap/Internal/Types.hs
@@ -319,6 +319,17 @@ method m action = do
------------------------------------------------------------------------------
+-- | Runs a 'Snap' monad action only if the request's HTTP method matches
+-- one of the given methods.
+methods :: MonadSnap m => [Method] -> m a -> m a
+methods ms action = do
+ req <- getRequest
+ unless (rqMethod req `elem` ms) pass
+ action
+{-# INLINE methods #-}
+
+
+------------------------------------------------------------------------------
-- Appends n bytes of the path info to the context path with a
-- trailing slash.
updateContextPath :: Int -> Request -> Request
diff --git a/src/Snap/Types.hs b/src/Snap/Types.hs
index 254e1d4..c8a71a6 100644
--- a/src/Snap/Types.hs
+++ b/src/Snap/Types.hs
@@ -20,6 +20,7 @@ module Snap.Types
-- ** Routing
, method
+ , methods
, path
, dir
, ifTop
-----------------------------------------------------------------------
hooks/post-receive
--
snap-core
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap