Change some ByteString to String
This commit is contained in:
parent
327401eee4
commit
02cf6f84d3
@ -81,9 +81,9 @@ class Eq u => RenderRoute u where
|
|||||||
|
|
||||||
-- | This class is automatically instantiated when you use the template haskell
|
-- | This class is automatically instantiated when you use the template haskell
|
||||||
-- mkYesod function. You should never need to deal with it directly.
|
-- mkYesod function. You should never need to deal with it directly.
|
||||||
class Yesod master => YesodDispatch a master where
|
class YesodDispatch a master where
|
||||||
yesodDispatch
|
yesodDispatch
|
||||||
:: (Yesod master)
|
:: Yesod master
|
||||||
=> a
|
=> a
|
||||||
-> Maybe CS.Key
|
-> Maybe CS.Key
|
||||||
-> [String]
|
-> [String]
|
||||||
@ -111,9 +111,7 @@ class RenderRoute (Route a) => Yesod a where
|
|||||||
--
|
--
|
||||||
-- * You do not use any features that require absolute URLs, such as Atom
|
-- * You do not use any features that require absolute URLs, such as Atom
|
||||||
-- feeds and XML sitemaps.
|
-- feeds and XML sitemaps.
|
||||||
--
|
approot :: a -> String
|
||||||
-- FIXME: is this the right typesig?
|
|
||||||
approot :: a -> S.ByteString
|
|
||||||
|
|
||||||
-- | The encryption key to be used for encrypting client sessions.
|
-- | The encryption key to be used for encrypting client sessions.
|
||||||
-- Returning 'Nothing' disables sessions.
|
-- Returning 'Nothing' disables sessions.
|
||||||
@ -150,7 +148,7 @@ class RenderRoute (Route a) => Yesod a where
|
|||||||
-- | Override the rendering function for a particular URL. One use case for
|
-- | Override the rendering function for a particular URL. One use case for
|
||||||
-- this is to offload static hosting to a different domain name to avoid
|
-- this is to offload static hosting to a different domain name to avoid
|
||||||
-- sending cookies.
|
-- sending cookies.
|
||||||
urlRenderOverride :: a -> Route a -> Maybe S.ByteString
|
urlRenderOverride :: a -> Route a -> Maybe String
|
||||||
urlRenderOverride _ _ = Nothing
|
urlRenderOverride _ _ = Nothing
|
||||||
|
|
||||||
-- | Determine if a request is authorized or not.
|
-- | Determine if a request is authorized or not.
|
||||||
@ -203,19 +201,12 @@ class RenderRoute (Route a) => Yesod a where
|
|||||||
|
|
||||||
-- | Join the pieces of a path together into an absolute URL. This should
|
-- | Join the pieces of a path together into an absolute URL. This should
|
||||||
-- be the inverse of 'splitPath'.
|
-- be the inverse of 'splitPath'.
|
||||||
--
|
|
||||||
-- FIXME is this the right type sig?
|
|
||||||
joinPath :: a
|
joinPath :: a
|
||||||
-> S.ByteString -- ^ application root
|
-> String -- ^ application root
|
||||||
-> [String] -- ^ path pieces
|
-> [String] -- ^ path pieces
|
||||||
-> [(String, String)] -- ^ query string
|
-> [(String, String)] -- ^ query string
|
||||||
-> S.ByteString
|
-> String
|
||||||
joinPath _ ar pieces qs =
|
joinPath _ ar pieces qs = ar ++ '/' : encodePathInfo pieces qs
|
||||||
S.concat
|
|
||||||
[ ar
|
|
||||||
, S8.singleton '/'
|
|
||||||
, S8.pack $ encodePathInfo pieces qs
|
|
||||||
]
|
|
||||||
|
|
||||||
-- | This function is used to store some static content to be served as an
|
-- | This function is used to store some static content to be served as an
|
||||||
-- external file. The most common case of this is stashing CSS and
|
-- external file. The most common case of this is stashing CSS and
|
||||||
@ -493,9 +484,9 @@ yesodRender :: Yesod y
|
|||||||
-> [(String, String)]
|
-> [(String, String)]
|
||||||
-> String
|
-> String
|
||||||
yesodRender y u qs =
|
yesodRender y u qs =
|
||||||
S8.unpack $ fromMaybe
|
fromMaybe
|
||||||
(joinPath y (approot y) ps $ qs ++ qs')
|
(joinPath y (approot y) ps $ qs ++ qs')
|
||||||
(urlRenderOverride y u)
|
(urlRenderOverride y u)
|
||||||
where
|
where
|
||||||
(ps, qs') = renderRoute u
|
(ps, qs') = renderRoute u
|
||||||
|
|
||||||
|
|||||||
@ -203,14 +203,10 @@ toWaiApp' y key' env = do
|
|||||||
dest' =
|
dest' =
|
||||||
if S.null (W.queryString env)
|
if S.null (W.queryString env)
|
||||||
then dest
|
then dest
|
||||||
else S.concat
|
else dest ++ '?' : B.unpack (W.queryString env)
|
||||||
[ dest
|
|
||||||
, B.singleton '?'
|
|
||||||
, W.queryString env
|
|
||||||
]
|
|
||||||
in return $ W.responseLBS W.status301
|
in return $ W.responseLBS W.status301
|
||||||
[ ("Content-Type", "text/plain")
|
[ ("Content-Type", "text/plain")
|
||||||
, ("Location", dest')
|
, ("Location", B.pack $ dest')
|
||||||
] "Redirecting"
|
] "Redirecting"
|
||||||
|
|
||||||
#if TEST
|
#if TEST
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user