@@ -1029,8 +1029,7 @@ useHttpURI uri = do
1029 urlHead <- http <$> uriHost uri
1029 urlHead <- http <$> uriHost uri
1030 let url = case URI.uriPath uri of
1030 let url = case URI.uriPath uri of
1031 Nothing -> urlHead
1031 Nothing -> urlHead
1032− Just (_, xs) ->
1032+ Just uriPath -> uriPathToUrl uriPath urlHead
1033− foldl' (/:) urlHead (URI.unRText <$> NE.toList xs)
1034 return (url, uriOptions uri)
1033 return (url, uriOptions uri)
1036-- | Just like 'useHttpURI', but expects the “https” scheme.
1035-- | Just like 'useHttpURI', but expects the “https” scheme.
@@ -1042,10 +1041,21 @@ useHttpsURI uri = do
1042 urlHead <- https <$> uriHost uri
1041 urlHead <- https <$> uriHost uri
1043 let url = case URI.uriPath uri of
1042 let url = case URI.uriPath uri of
1044 Nothing -> urlHead
1043 Nothing -> urlHead
1045− Just (_, xs) ->
1044+ Just uriPath -> uriPathToUrl uriPath urlHead
1046− foldl' (/:) urlHead (URI.unRText <$> NE.toList xs)
1047 return (url, uriOptions uri)
1045 return (url, uriOptions uri)
1047+-- | Convert URI path to a 'Url'. Internal.
1051+ (Bool, NonEmpty (URI.RText 'URI.PathPiece)) ->
1054+uriPathToUrl (trailingSlash, xs) urlHead =
1055+ if trailingSlash then path /: T.empty else path
1057+ path = foldl' (/:) urlHead (URI.unRText <$> NE.toList xs)
1049-- | A combination of 'useHttpURI' and 'useHttpsURI' for cases when scheme
1059-- | A combination of 'useHttpURI' and 'useHttpsURI' for cases when scheme
1050-- is not known in advance.
1060-- is not known in advance.