diff --git a/lib/Web/Hikaru/Action.hs b/lib/Web/Hikaru/Action.hs index 8d5cd23a5ffb85fcfdddf0731baa548dcb08fdb6..b4b5ca9574f0f1934ef63f1d69b674b35db35783 100644 --- a/lib/Web/Hikaru/Action.hs +++ b/lib/Web/Hikaru/Action.hs @@ -62,6 +62,7 @@ module Web.Hikaru.Action , sendText , sendString , sendJSON + , redirect , setResponseFile , setResponseBuilder , setResponseBS @@ -843,6 +844,16 @@ where setResponseBS (encode json) + -- | + -- Set the @Location@ header and response status to redirect the user + -- elsewhere. + -- + redirect :: (MonadAction m) => Text -> m () + redirect location = do + setStatus status302 + setHeader hLocation (cs location) + + -- | -- Create response body using a file. --