Escape segments in linkURI
This commit is contained in:
parent
2cfcff4c7f
commit
54c3053342
1 changed files with 5 additions and 1 deletions
|
@ -164,6 +164,10 @@ addQueryParam qp l =
|
|||
-- >>> linkURI $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API) [1, 2, 3]
|
||||
-- sum?x[]=1&x[]=2&x[]=3
|
||||
--
|
||||
-- >>> type API = "foo/bar" :> Get '[JSON] Int
|
||||
-- >>> linkURI $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API)
|
||||
-- foo%2Fbar
|
||||
--
|
||||
linkURI :: Link -> URI
|
||||
linkURI = linkURI' LinkArrayElementBracket
|
||||
|
||||
|
@ -186,7 +190,7 @@ linkURI' :: LinkArrayElementStyle -> Link -> URI
|
|||
linkURI' addBrackets (Link segments q_params) =
|
||||
URI mempty -- No scheme (relative)
|
||||
Nothing -- Or authority (relative)
|
||||
(intercalate "/" segments)
|
||||
(intercalate "/" $ map escape segments)
|
||||
(makeQueries q_params) mempty
|
||||
where
|
||||
makeQueries :: [Param] -> String
|
||||
|
|
Loading…
Reference in a new issue