0

Given a url like http://test.com/abc/xyz/1/2/3, how can I retrieve all the URL segments after abc/ so the resulting value would be ["xyz","1","2","3]?

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286

1 Answers1

0

In case anybody stumbles upon this in future, I've managed to resolve it with:

processParams :: String -> Request -> Maybe [Param]
processParams s x  = do
  case (params', isPrefix) of
    (_:paramsxs, True) -> return $ fmap (flip (,) $ "") paramsxs
    _  -> Nothing
    where
      isPrefix = s `isPrefixOf` (convertString path) :: Bool
      path = rawPathInfo x
      params' = fmap convertString $ decodePathSegments path

And using the function function:

get (function $ processParams "/comparePackage") $ comparePackageHandler
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286