Only add a ? when query string is nonempty (#1589)
* Only add a ? when query string is nonempty
* Adds changelog entry
commit1fba9dc6048cea6184964032b861b052cd54878c
authorIan Shipman <22924983+GambolingPangolin@users.noreply.github.com>
dateMon 16 May 2022, 09:50 (4 years ago)
parent8ef5021
changelog.d/1589new file+2
@@ -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+2−1
@@ -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