Permalink
Browse files

Merge pull request #176 from henrylaxen/master

Add addCookies to Snap.Test
  • Loading branch information...
2 parents 4286072 + 5b1e207 commit d025f43cb306c11669bf288c6d9e33d2f625dc2b @gregorycollins gregorycollins committed Mar 19, 2013
Showing with 7 additions and 0 deletions.
  1. +6 −0 src/Snap/Internal/Test/RequestBuilder.hs
  2. +1 −0 src/Snap/Test.hs
View
6 src/Snap/Internal/Test/RequestBuilder.hs
@@ -25,6 +25,7 @@ module Snap.Internal.Test.RequestBuilder
, runHandlerM
, setContentType
, setHeader
+ , addCookies
, setHttpVersion
, setQueryString
, setQueryStringRaw
@@ -430,6 +431,11 @@ setHeader k v = rModify (H.setHeader k v)
addHeader :: (Monad m) => CI ByteString -> ByteString -> RequestBuilder m ()
addHeader k v = rModify (H.addHeader k v)
+------------------------------------------------------------------------------
+-- | Adds the given cookies to the request being built.
+addCookies :: (Monad m) => [Cookie] -> RequestBuilder m ()
+addCookies cookies = do
+ rModify $ \rq -> rq { rqCookies = rqCookies rq ++ cookies }
------------------------------------------------------------------------------
-- | Sets the request's @content-type@ to the given MIME type.
View
1 src/Snap/Test.hs
@@ -29,6 +29,7 @@ module Snap.Test
, addHeader
, setContentType
, setHeader
+ , addCookies
, setHttpVersion
, setQueryString
, setQueryStringRaw

0 comments on commit d025f43

Please sign in to comment.