packages feed

salvia-0.1: src/Network/Salvia/Handler/Redirect.hs

module Network.Salvia.Handler.Redirect (hRedirect) where

import Data.Record.Label
import Network.Protocol.Http
import Network.Protocol.Uri (URI)
import Network.Salvia.Httpd

{- |
Redirect a client to another location by creating a `MovedPermanently` response
message with the specified `URI` in the `location' header.
-}

hRedirect :: URI -> Handler ()
hRedirect u =
  enterM response $ do
    setM location (Just u)
    setM status MovedPermanently