on master help sign in
Adjustments after merging #49
83db2cbmrkkrp
CHANGELOG.md+4
@@ -1,3 +1,7 @@
1+## Req 1.2.0
2+
3+* Added the `parseUrl` function.
4+
1## Req 1.1.0
5## Req 1.1.0
2
6
3* Added `customAuth` and `attachHeader` to facilitate creation of custom
7* Added `customAuth` and `attachHeader` to facilitate creation of custom
Network/HTTP/Req.hs+9−5
@@ -799,7 +799,7 @@ instance HttpMethod method => RequestComponent (Womb "method" method) where
799-- $url
799-- $url
800--
800--
801-- We use 'Url's which are correct by construction, see 'Url'. To build a
801-- We use 'Url's which are correct by construction, see 'Url'. To build a
802−-- 'Url' from a 'ByteString', use 'parseUrlHttp', 'parseUrlHttps' or
802+-- 'Url' from a 'ByteString', use 'parseUrlHttp', 'parseUrlHttps', or
803-- generic 'parseUrl'.
803-- generic 'parseUrl'.
804
804
805-- | Request's 'Url'. Start constructing your 'Url' with 'http' or 'https'
805-- | Request's 'Url'. Start constructing your 'Url' with 'http' or 'https'
@@ -886,11 +886,15 @@ parseUrlHttps url' = do
886 (host :| path, option) <- parseUrlHelper url
886 (host :| path, option) <- parseUrlHelper url
887 return (foldl (/:) (https host) path, option)
887 return (foldl (/:) (https host) path, option)
888
888
889−-- | 'parseUrlHttp' and 'parseUrlHttps' companion that can be used
889+-- | A more general URI parsing function that can be used when scheme is not
890−-- when scheme is not known beforehand.
890+-- known beforehand.
891+--
892+-- @since 1.2.0
891
893
894+parseUrl
895+ :: ByteString
892−parseUrl :: ByteString -> Maybe (Either (Url 'Http, Option scheme) (Url 'Https, Option scheme))
896+ -> Maybe (Either (Url 'Http, Option scheme) (Url 'Https, Option scheme))
893−parseUrl url' = Left <$> parseUrlHttp url' <|> Right <$> parseUrlHttps url'
897+parseUrl url = Left <$> parseUrlHttp url <|> Right <$> parseUrlHttps url
894
898
895-- | Get host\/collection of path pieces and possibly query parameters
899-- | Get host\/collection of path pieces and possibly query parameters
896-- already converted to 'Option'. This function is not public.
900-- already converted to 'Option'. This function is not public.