on master help sign in
Only include cookie header if there are cookies
commita44478e65f23abc827e4049943b04217a06c7247 authorMichael Snoyman <michael@snoyman.com> dateThu 2 Apr 2015, 16:28 (12 years ago) parent4684a4c
3 files changed+10−2
wai-extra/ChangeLog.md+5 wai-extra/Network/Wai/Test.hs+4−1 wai-extra/wai-extra.cabal+1−1
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+
16## 3.0.6
27
38* 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
154154 | c <- map snd $ Map.toList cookiesForRequest
155155 ]
156156 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 }
158161 where checkCookieTime t c =
159162 case Cookie.setCookieExpires c of
160163 Nothing -> True
wai-extra/wai-extra.cabal+1−1
@@ -1,5 +1,5 @@
11Name: wai-extra
2−Version: 3.0.6
2+Version: 3.0.6.1
33Synopsis: Provides some basic WAI handlers and middleware.
44description:
55 Provides basic WAI handler and middleware functionality: