Only add a ? when query string is nonempty (#1589)
* Only add a ? when query string is nonempty * Adds changelog entry
This commit is contained in:
parent
8ef5021a5f
commit
1fba9dc604
2 changed files with 4 additions and 1 deletions
2
changelog.d/1589
Normal file
2
changelog.d/1589
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
synopsis: Only include question mark for nonempty query strings
|
||||||
|
prs: 1589
|
|
@ -289,7 +289,8 @@ defaultMakeClientRequest burl r = Client.defaultRequest
|
||||||
Https -> True
|
Https -> True
|
||||||
|
|
||||||
-- Query string builder which does not do any encoding
|
-- Query string builder which does not do any encoding
|
||||||
buildQueryString = ("?" <>) . foldl' addQueryParam mempty
|
buildQueryString [] = mempty
|
||||||
|
buildQueryString qps = "?" <> foldl' addQueryParam mempty qps
|
||||||
|
|
||||||
addQueryParam qs (k, v) =
|
addQueryParam qs (k, v) =
|
||||||
qs <> (if BS.null qs then mempty else "&") <> urlEncode True k <> foldMap ("=" <>) v
|
qs <> (if BS.null qs then mempty else "&") <> urlEncode True k <> foldMap ("=" <>) v
|
||||||
|
|
Loading…
Reference in a new issue