From 0c4ded0fd1b9dfc9a617141daed74d636bde69ec Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 25 Nov 2012 21:45:08 +0200 Subject: [PATCH] Slightly more efficient header construction --- yesod-core/Yesod/Handler.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yesod-core/Yesod/Handler.hs b/yesod-core/Yesod/Handler.hs index 9a952752..569f5c8d 100644 --- a/yesod-core/Yesod/Handler.hs +++ b/yesod-core/Yesod/Handler.hs @@ -522,12 +522,12 @@ runHandler handler mrender sroute tomr master sub upload log' = Right c' -> return $ YARPlain status (appEndo headers []) ct c' finalSession HCError e -> handleError e HCRedirect status loc -> do - let disable_caching = - [ Header "Cache-Control" "no-cache, must-revalidate" - , Header "Expires" "Thu, 01 Jan 1970 05:05:05 GMT" - ] - hs = (if status /= H.movedPermanently301 then disable_caching else []) - ++ Header "Location" (encodeUtf8 loc) : appEndo headers [] + let disable_caching x = + Header "Cache-Control" "no-cache, must-revalidate" + : Header "Expires" "Thu, 01 Jan 1970 05:05:05 GMT" + : x + hs = (if status /= H.movedPermanently301 then disable_caching else id) + $ Header "Location" (encodeUtf8 loc) : appEndo headers [] return $ YARPlain status hs typePlain emptyContent finalSession