req 3.8.0 → 3.9.0
raw patch · 4 files changed
+27/−11 lines, 4 files
Files
- CHANGELOG.md +5/−0
- Network/HTTP/Req.hs +14/−4
- pure-tests/Network/HTTP/ReqSpec.hs +3/−2
- req.cabal +5/−5
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Req 3.9.0++* The `useHttpURI` and `useHttpsURI` functions now preserve trailing+ slashes.+ ## Req 3.8.0 * Adjusted the value of the `httpConfigRetryJudgeException` field of
Network/HTTP/Req.hs view
@@ -1029,8 +1029,7 @@ urlHead <- http <$> uriHost uri let url = case URI.uriPath uri of Nothing -> urlHead- Just (_, xs) ->- foldl' (/:) urlHead (URI.unRText <$> NE.toList xs)+ Just uriPath -> uriPathToUrl uriPath urlHead return (url, uriOptions uri) -- | Just like 'useHttpURI', but expects the “https” scheme.@@ -1042,9 +1041,20 @@ urlHead <- https <$> uriHost uri let url = case URI.uriPath uri of Nothing -> urlHead- Just (_, xs) ->- foldl' (/:) urlHead (URI.unRText <$> NE.toList xs)+ Just uriPath -> uriPathToUrl uriPath urlHead return (url, uriOptions uri)++-- | Convert URI path to a 'Url'. Internal.+--+-- @since 3.9.0+uriPathToUrl ::+ (Bool, NonEmpty (URI.RText 'URI.PathPiece)) ->+ Url scheme ->+ Url scheme+uriPathToUrl (trailingSlash, xs) urlHead =+ if trailingSlash then path /: T.empty else path+ where+ path = foldl' (/:) urlHead (URI.unRText <$> NE.toList xs) -- | A combination of 'useHttpURI' and 'useHttpsURI' for cases when scheme -- is not known in advance.
pure-tests/Network/HTTP/ReqSpec.hs view
@@ -565,8 +565,9 @@ -- | Get path from 'URI'. uriPath :: URI -> ByteString uriPath uri = fromMaybe "" $ do- (_, xs) <- URI.uriPath uri- (return . encodePathPieces . fmap URI.unRText . NE.toList) xs+ (trailingSlash, xs) <- URI.uriPath uri+ let pref = (encodePathPieces . fmap URI.unRText . NE.toList) xs+ return $ if trailingSlash then pref <> "/" else pref -- | Get query string from 'URI'. uriQuery :: URI -> ByteString
req.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.18 name: req-version: 3.8.0+version: 3.9.0 license: BSD3 license-file: LICENSE.md maintainer: Mark Karpov <markkarpov92@gmail.com> author: Mark Karpov <markkarpov92@gmail.com>-tested-with: ghc ==8.6.5 ghc ==8.8.4 ghc ==8.10.2+tested-with: ghc ==8.6.5 ghc ==8.8.4 ghc ==8.10.3 homepage: https://github.com/mrkkrp/req bug-reports: https://github.com/mrkkrp/req/issues synopsis:@@ -41,7 +41,7 @@ authenticate-oauth >=1.5 && <1.7, base >=4.12 && <5.0, blaze-builder >=0.3 && <0.5,- bytestring >=0.10.8 && <0.11,+ bytestring >=0.10.8 && <0.12, case-insensitive >=0.2 && <1.3, connection >=0.2.2 && <0.4, exceptions >=0.6 && <0.11,@@ -83,7 +83,7 @@ aeson >=0.9 && <1.6, base >=4.12 && <5.0, blaze-builder >=0.3 && <0.5,- bytestring >=0.10.8 && <0.11,+ bytestring >=0.10.8 && <0.12, case-insensitive >=0.2 && <1.3, hspec >=2.0 && <3.0, hspec-core >=2.0 && <3.0,@@ -114,7 +114,7 @@ QuickCheck >=2.7 && <3.0, aeson >=0.9 && <1.6, base >=4.12 && <5.0,- bytestring >=0.10.8 && <0.11,+ bytestring >=0.10.8 && <0.12, hspec >=2.0 && <3.0, http-client >=0.5 && <0.8, http-types >=0.8 && <10.0,