Skip to content

Commit

Permalink
Merge pull request #1597 from typeable/master
Browse files Browse the repository at this point in the history
Escape special chars in QueryParams
  • Loading branch information
jkarni committed Apr 20, 2023
2 parents 8e35245 + b3279d9 commit 79a29b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions servant-client-core/src/Servant/Client/Core/Request.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ import Network.HTTP.Media
(MediaType)
import Network.HTTP.Types
(Header, HeaderName, HttpVersion (..), Method, QueryItem,
http11, methodGet)
http11, methodGet, urlEncodeBuilder)
import Servant.API
(ToHttpApiData, toEncodedUrlPiece, toHeader, SourceIO)
(ToHttpApiData, toEncodedUrlPiece, toQueryParam, toHeader, SourceIO)

import Servant.Client.Core.Internal (mediaTypeRnf)

Expand Down Expand Up @@ -165,7 +165,8 @@ appendToQueryString pname pvalue req
-- | Encode a query parameter value.
--
encodeQueryParamValue :: ToHttpApiData a => a -> BS.ByteString
encodeQueryParamValue = LBS.toStrict . Builder.toLazyByteString . toEncodedUrlPiece
encodeQueryParamValue = LBS.toStrict . Builder.toLazyByteString
. urlEncodeBuilder True . encodeUtf8 . toQueryParam

-- | Add header to the request being constructed.
--
Expand Down

0 comments on commit 79a29b0

Please sign in to comment.