uri-bytestring 0.2.1.1 → 0.2.1.2
raw patch · 4 files changed
+21/−8 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +3/−0
- src/URI/ByteString/Internal.hs +3/−3
- test/URI/ByteStringTests.hs +14/−4
- uri-bytestring.cabal +1/−1
changelog.md view
@@ -1,3 +1,6 @@+0.2.1.2+* Fixed bug introduced at 0.2.1.1 where RelativeRefs would fail to serialize their port numbers.+ 0.2.1.1 * Add URI normalization features.
src/URI/ByteString/Internal.hs view
@@ -272,10 +272,10 @@ port = maybe mempty packPort effectivePort effectivePort = do p <- authorityPort- scheme <- mScheme- dropPort scheme p+ dropPort mScheme p packPort (Port p) = c8 ':' <> BB.fromString (show p)- dropPort scheme+ dropPort Nothing = Just+ dropPort (Just scheme) | unoDropDefPort = dropPort' scheme | otherwise = Just dropPort' s p
test/URI/ByteStringTests.hs view
@@ -320,21 +320,31 @@ testCase "renders userinfo correctly" $ do let ui = UserInfo "user" "pass" let uri = URI (Scheme "http")- (Just (Authority (Just ui) (Host "www.example.org") Nothing))+ (Just (Authority (Just ui) (Host "www.example.org") (Just port))) "/" (Query [("foo", "bar")]) (Just "somefragment") let res = BB.toLazyByteString (serializeURIRef uri)- res @?= "http://user:pass@www.example.org/?foo=bar#somefragment"+ res @?= "http://user:pass@www.example.org:123/?foo=bar#somefragment" , testCase "encodes decoded paths" $ do let uri = URI (Scheme "http")- (Just (Authority Nothing (Host "www.example.org") Nothing))+ (Just (Authority Nothing (Host "www.example.org") (Just port))) "/weird path" (Query []) Nothing let res = BB.toLazyByteString (serializeURIRef uri)- res @?= "http://www.example.org/weird%20path"+ res @?= "http://www.example.org:123/weird%20path"+ , testCase "encodes relative refs" $ do+ let ui = UserInfo "user" "pass"+ let uri = RelativeRef (Just (Authority (Just ui) (Host "www.example.org") (Just port)))+ "/"+ (Query [("foo", "bar")])+ (Just "somefragment")+ let res = BB.toLazyByteString (serializeURIRef uri)+ res @?= "//user:pass@www.example.org:123/?foo=bar#somefragment" ]+ where+ port = Port 123 -------------------------------------------------------------------------------
uri-bytestring.cabal view
@@ -1,5 +1,5 @@ name: uri-bytestring-version: 0.2.1.1+version: 0.2.1.2 synopsis: Haskell URI parsing as ByteStrings description: uri-bytestring aims to be an RFC3986 compliant URI parser that uses efficient ByteStrings for parsing and representing the URI data. license: BSD3