git.iko.soy/typeable/http-api-data
on master help sign in
Merge pull request #75 from Tritlo/master

Remove dependency on uri-bytestring and use functions from http-types instead

commit409923cb171ed0bff065537c9f51c7f1127e62f8 authorNickolay Kudasov <fizruk@users.noreply.github.com> dateMon 24 Sep 2018, 19:15 (8 years ago) parent48efb740e288de
2 files changed+3−4
http-api-data.cabal−1 src/Web/Internal/FormUrlEncoded.hs+3−3
http-api-data.cabal−1
@@ -51,7 +51,6 @@ library
5151 , time >= 1.4.2 && < 1.9
5252 , time-locale-compat >= 0.1.1.0 && < 0.2
5353 , unordered-containers >= 0.2.6.0 && < 0.3
54− , uri-bytestring >= 0.1.7 && < 0.4
5554 , uuid-types >= 1.0.2 && <1.1
5655 if !impl(ghc >= 8.0)
5756 build-depends: semigroups >= 0.16 && < 0.19
src/Web/Internal/FormUrlEncoded.hs+3−3
@@ -60,7 +60,7 @@ import Numeric.Natural
6060import GHC.Exts (IsList (..), Constraint)
6161import GHC.Generics
6262import GHC.TypeLits
63−import URI.ByteString (urlEncodeQuery, urlDecodeQuery)
63+import Network.HTTP.Types.URI (urlEncodeBuilder, urlDecode)
6464
6565import Web.Internal.HttpApiData
6666
@@ -543,7 +543,7 @@ urlEncodeFormStable = urlEncodeParams . sortOn fst . toList
543543urlEncodeParams :: [(Text, Text)] -> BSL.ByteString
544544urlEncodeParams = toLazyByteString . mconcat . intersperse (shortByteString "&") . map encodePair
545545 where
546− escape = urlEncodeQuery . Text.encodeUtf8
546+ escape = urlEncodeBuilder True . Text.encodeUtf8
547547
548548 encodePair (k, "") = escape k
549549 encodePair (k, v) = escape k <> shortByteString "=" <> escape v
@@ -590,7 +590,7 @@ urlDecodeParams bs = traverse parsePair pairs
590590 where
591591 pairs = map (BSL8.split '=') (BSL8.split '&' bs)
592592
593− unescape = Text.decodeUtf8With lenientDecode . urlDecodeQuery . BSL.toStrict
593+ unescape = Text.decodeUtf8With lenientDecode . urlDecode True . BSL.toStrict
594594
595595 parsePair p =
596596 case map unescape p of