Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion http-api-data.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ library
, time >= 1.4.2 && < 1.9
, time-locale-compat >= 0.1.1.0 && < 0.2
, unordered-containers >= 0.2.6.0 && < 0.3
, uri-bytestring >= 0.1.7 && < 0.4
, uuid-types >= 1.0.2 && <1.1
if !impl(ghc >= 8.0)
build-depends: semigroups >= 0.16 && < 0.19
Expand Down
6 changes: 3 additions & 3 deletions src/Web/Internal/FormUrlEncoded.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Numeric.Natural
import GHC.Exts (IsList (..), Constraint)
import GHC.Generics
import GHC.TypeLits
import URI.ByteString (urlEncodeQuery, urlDecodeQuery)
import Network.HTTP.Types.URI (urlEncodeBuilder, urlDecode)

import Web.Internal.HttpApiData

Expand Down Expand Up @@ -543,7 +543,7 @@ urlEncodeFormStable = urlEncodeParams . sortOn fst . toList
urlEncodeParams :: [(Text, Text)] -> BSL.ByteString
urlEncodeParams = toLazyByteString . mconcat . intersperse (shortByteString "&") . map encodePair
where
escape = urlEncodeQuery . Text.encodeUtf8
escape = urlEncodeBuilder True . Text.encodeUtf8

encodePair (k, "") = escape k
encodePair (k, v) = escape k <> shortByteString "=" <> escape v
Expand Down Expand Up @@ -590,7 +590,7 @@ urlDecodeParams bs = traverse parsePair pairs
where
pairs = map (BSL8.split '=') (BSL8.split '&' bs)

unescape = Text.decodeUtf8With lenientDecode . urlDecodeQuery . BSL.toStrict
unescape = Text.decodeUtf8With lenientDecode . urlDecode True . BSL.toStrict

parsePair p =
case map unescape p of
Expand Down