on master help sign in
Only include cookie header if there are cookies
a44478eMichael Snoyman
wai-extra/ChangeLog.md+5
@@ -1,3 +1,8 @@
1+## 3.0.6.1
2+
3+* Test code: only include a Cookie header if there are cookies. Without this
4+ patch, yesod-test cookie handling is broken.
5+
1## 3.0.6
6## 3.0.6
2
7
3* Add Cookie Handling to Network.Wai.Test [#356](https://github.com/yesodweb/wai/pull/356)
8* Add Cookie Handling to Network.Wai.Test [#356](https://github.com/yesodweb/wai/pull/356)
wai-extra/Network/Wai/Test.hs+4−1
@@ -154,7 +154,10 @@ addCookiesToRequest req = do
154 | c <- map snd $ Map.toList cookiesForRequest
154 | c <- map snd $ Map.toList cookiesForRequest
155 ]
155 ]
156 let cookieValue = toByteString $ Cookie.renderCookies cookiePairs
156 let cookieValue = toByteString $ Cookie.renderCookies cookiePairs
157− return $ req { requestHeaders = ("Cookie", cookieValue):requestHeaders req }
157+ addCookieHeader rest
158+ | null cookiePairs = rest
159+ | otherwise = ("Cookie", cookieValue) : rest
160+ return $ req { requestHeaders = addCookieHeader $ requestHeaders req }
158 where checkCookieTime t c =
161 where checkCookieTime t c =
159 case Cookie.setCookieExpires c of
162 case Cookie.setCookieExpires c of
160 Nothing -> True
163 Nothing -> True
wai-extra/wai-extra.cabal+1−1
@@ -1,5 +1,5 @@
1Name: wai-extra
1Name: wai-extra
2−Version: 3.0.6
2+Version: 3.0.6.1
3Synopsis: Provides some basic WAI handlers and middleware.
3Synopsis: Provides some basic WAI handlers and middleware.
4description:
4description:
5 Provides basic WAI handler and middleware functionality:
5 Provides basic WAI handler and middleware functionality: