From 23278d651e4fc2119d4ef55b4469e39a51b66ae4 Mon Sep 17 00:00:00 2001 From: Mark Wotton Date: Mon, 21 Mar 2016 17:41:25 -0400 Subject: [PATCH] documentation fixes & formatting #3 --- yesod-test/Yesod/Test.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/yesod-test/Yesod/Test.hs b/yesod-test/Yesod/Test.hs index 9a689349..7da770ab 100644 --- a/yesod-test/Yesod/Test.hs +++ b/yesod-test/Yesod/Test.hs @@ -695,16 +695,15 @@ get url = request $ do setUrl url -- | Follow a redirect, if the last response was a redirect. --- | (We consider a request a redirect if the status is --- | 301, 302, 303, 307 or 308, and the Location header is set.) --- | --- | Return Left with an error message if not a redirect --- | Return Right with the redirected URL if it was. +-- (We consider a request a redirect if the status is +-- 301, 302, 303, 307 or 308, and the Location header is set.) -- -- ==== __Examples__ -- -- > get HomeR -- > followRedirect +followRedirect :: Yesod site + => YesodExample site (Either T.Text T.Text) -- ^ 'Left' with an error message if not a redirect, 'Right' with the redirected URL if it was followRedirect :: Yesod site => YesodExample site (Either T.Text T.Text) followRedirect = do @@ -713,7 +712,7 @@ followRedirect = do Nothing -> return $ Left "followRedirect called, but there was no previous response, so no redirect to follow" Just r -> do if not ((H.statusCode $ simpleStatus r) `elem` [301, 302, 303, 307, 308]) - then return $ Left "followRedirect called, but previous request was not a redirect" + then return $ Left "followRedirect called, but previous request was not a redirect" else do case lookup "Location" (simpleHeaders r) of Nothing -> return $ Left "followRedirect called, but no location header set"