Escape special chars in QueryParams
This commit is contained in:
parent
f0e2316895
commit
b3279d9e19
1 changed files with 4 additions and 3 deletions
|
@ -51,9 +51,9 @@ import Network.HTTP.Media
|
||||||
(MediaType)
|
(MediaType)
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
(Header, HeaderName, HttpVersion (..), Method, QueryItem,
|
(Header, HeaderName, HttpVersion (..), Method, QueryItem,
|
||||||
http11, methodGet)
|
http11, methodGet, urlEncodeBuilder)
|
||||||
import Servant.API
|
import Servant.API
|
||||||
(ToHttpApiData, toEncodedUrlPiece, toHeader, SourceIO)
|
(ToHttpApiData, toEncodedUrlPiece, toQueryParam, toHeader, SourceIO)
|
||||||
|
|
||||||
import Servant.Client.Core.Internal (mediaTypeRnf)
|
import Servant.Client.Core.Internal (mediaTypeRnf)
|
||||||
|
|
||||||
|
@ -165,7 +165,8 @@ appendToQueryString pname pvalue req
|
||||||
-- | Encode a query parameter value.
|
-- | Encode a query parameter value.
|
||||||
--
|
--
|
||||||
encodeQueryParamValue :: ToHttpApiData a => a -> BS.ByteString
|
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.
|
-- | Add header to the request being constructed.
|
||||||
--
|
--
|
||||||
|
|
Loading…
Reference in a new issue