Skip to content

Commit 1fba9dc

Browse files
Only add a ? when query string is nonempty (#1589)
* Only add a ? when query string is nonempty * Adds changelog entry
1 parent 8ef5021 commit 1fba9dc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

changelog.d/1589

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
synopsis: Only include question mark for nonempty query strings
2+
prs: 1589

servant-client/src/Servant/Client/Internal/HttpClient.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ defaultMakeClientRequest burl r = Client.defaultRequest
289289
Https -> True
290290

291291
-- Query string builder which does not do any encoding
292-
buildQueryString = ("?" <>) . foldl' addQueryParam mempty
292+
buildQueryString [] = mempty
293+
buildQueryString qps = "?" <> foldl' addQueryParam mempty qps
293294

294295
addQueryParam qs (k, v) =
295296
qs <> (if BS.null qs then mempty else "&") <> urlEncode True k <> foldMap ("=" <>) v

0 commit comments

Comments
 (0)