packages feed

happstack-server 7.3.0 → 7.3.1

raw patch · 3 files changed

+18/−2 lines, 3 files

Files

happstack-server.cabal view
@@ -1,5 +1,5 @@ Name:                happstack-server-Version:             7.3.0+Version:             7.3.1 Synopsis:            Web related tools and services. Description:         Happstack Server provides an HTTP server and a rich set of functions for routing requests, handling query parameters, generating responses, working with cookies, serving files, and more. For in-depth documentation see the Happstack Crash Course <http://happstack.com/docs/crashcourse/index.html> License:             BSD3
src/Happstack/Server/Internal/Types.hs view
@@ -405,7 +405,7 @@ -- type.  Does not force the key to be in lowercase or guarantee that the given key and the key in the HeaderPair will match. addHeaderUnsafe :: HasHeaders r => ByteString -> HeaderPair -> r -> r addHeaderUnsafe key val = updateHeaders (M.insertWith join key val)-    where join (HeaderPair k vs1) (HeaderPair _ vs2) = HeaderPair k (vs1++vs2)+    where join (HeaderPair k vs1) (HeaderPair _ vs2) = HeaderPair k (vs2++vs1)  -- | Creates a Response with the given Int as the status code and the provided -- String as the body of the Response
tests/Happstack/Server/Tests.hs view
@@ -31,6 +31,7 @@                                 , multipart                                 , compressFilterResponseTest                                 , matchMethodTest+                                , cookieHeaderOrderTest                                 ]  cookieParserTest :: Test@@ -142,6 +143,21 @@        msum [ dir "response" $ ok (toResponse "compress Response")             , dir "sendfile" $ ok (sendFileResponse "text/plain" "/dev/null" Nothing 0 100)             ]++cookieHeaderOrderTestHandler :: ServerPart Response+cookieHeaderOrderTestHandler = do+  expireCookie "thecookie"+  addCookie Session $ mkCookie "thecookie" "value"+  ok $ toResponse $ "works"++cookieHeaderOrderTest :: Test+cookieHeaderOrderTest =+  "cookie header order test" ~:+    do req <- mkRequest GET "/" [] Map.empty L.empty+       res <- simpleHTTP'' cookieHeaderOrderTestHandler req+       let Just pair = (Map.lookup (B.pack "set-cookie") (rsHeaders res))+       assertEqual "Add cookie wins" False $ B.isInfixOf (B.pack "Max-Age=0")+                                                         (last $ hValue pair)  uncompressedResponse :: Test uncompressedResponse =