uri-bytestring 0.1.4 → 0.1.5
raw patch · 4 files changed
+38/−2 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 +1/−1
- test/URI/ByteStringTests.hs +33/−0
- uri-bytestring.cabal +1/−1
changelog.md view
@@ -1,3 +1,6 @@+0.1.5+* Fix serialization bug where userinfo was not including the @ separator.+ 0.1.4 * Bump attoparsec bounds
src/URI/ByteString/Internal.hs view
@@ -96,7 +96,7 @@ ------------------------------------------------------------------------------- serializeUserInfo :: UserInfo -> Builder-serializeUserInfo UserInfo {..} = bs uiUsername <> c8 ':' <> bs uiPassword+serializeUserInfo UserInfo {..} = bs uiUsername <> c8 ':' <> bs uiPassword <> c8 '@' -------------------------------------------------------------------------------
test/URI/ByteStringTests.hs view
@@ -24,6 +24,7 @@ parseUriTests , uriParseErrorInstancesTests , lensTests+ , serializeURITests ] @@ -143,6 +144,8 @@ read (show e) == e ] ++------------------------------------------------------------------------------- lensTests :: TestTree lensTests = testGroup "lenses" [@@ -210,10 +213,13 @@ ((rr & rrFragmentL .~ x) === rr { rrFragment = x }) ] ++------------------------------------------------------------------------------- testParses :: ByteString -> URI -> TestTree testParses = testParses' strictURIParserOptions +------------------------------------------------------------------------------- testParseHost :: ByteString -> ByteString -> TestTree testParseHost uri expectedHost = testParses uri $@@ -224,10 +230,13 @@ Nothing ++------------------------------------------------------------------------------- testParsesLax :: ByteString -> URI -> TestTree testParsesLax = testParses' laxURIParserOptions +------------------------------------------------------------------------------- testParses' :: URIParserOptions -> ByteString -> URI -> TestTree testParses' opts s u = testGroup "testParses'" [ parseTestURI opts s $ Right u@@ -235,20 +244,24 @@ ] +------------------------------------------------------------------------------- makeRelativeRefTyped :: URI -> RelativeRef makeRelativeRefTyped (URI _ a p q f) = RelativeRef a p q f +------------------------------------------------------------------------------- makeRelativeRefBS :: ByteString -> ByteString makeRelativeRefBS s = B8.tail x where (_, x) = B8.break (==':') s +------------------------------------------------------------------------------- testParseFailure :: ByteString -> URIParseError -> TestTree testParseFailure s = parseTestURI strictURIParserOptions s . Left +------------------------------------------------------------------------------- parseTestURI :: URIParserOptions -> ByteString@@ -256,6 +269,8 @@ -> TestTree parseTestURI opts s r = testCase (B8.unpack s) $ parseURI opts s @?= r ++------------------------------------------------------------------------------- roundtripTestURI :: URIParserOptions -> ByteString@@ -263,6 +278,8 @@ roundtripTestURI opts s = testCase (B8.unpack s) $ (parseURI opts s >>= return . BB.toByteString . serializeURI) @?= Right s ++------------------------------------------------------------------------------- parseTestRelativeRef :: URIParserOptions -> ByteString@@ -270,3 +287,19 @@ -> TestTree parseTestRelativeRef opts s r = testCase (B8.unpack s) $ parseRelativeRef opts s @?= r+++-------------------------------------------------------------------------------+serializeURITests :: TestTree+serializeURITests = testGroup "serializeURI"+ [+ testCase "renders userinfo correctly" $ do+ let ui = UserInfo "user" "pass"+ let uri = URI (Scheme "http")+ (Just (Authority (Just ui) (Host "www.example.org") Nothing))+ "/"+ (Query [("foo", "bar")])+ (Just "somefragment")+ let res = BB.toLazyByteString (serializeURI uri)+ res @?= "http://user:pass@www.example.org/?foo=bar#somefragment"+ ]
uri-bytestring.cabal view
@@ -1,5 +1,5 @@ name: uri-bytestring-version: 0.1.4+version: 0.1.5 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