on master help sign in
Declared query string parameters are always sent in requests, even when no value is assigned to them (?name). The server handles a missing query parameter, and a query parameter with no value the same, but to be consistent with the documentation ("If you give Nothing, nothing will be added to the query string.") I made a small change to avoid sending empty query parameters. Also the value and req' parameters were flipped in the lambda in the QueryParams case.
commit83afdcb96ba6a6937c5ae4ac8ed4e87621156c0f authorDaniel Larsson <daniel.j.larsson@gmail.com> dateThu 1 Jan 2015, 15:14 (12 years ago) parentfbc012c
1 file changed+2−2
src/Servant/Client.hs+2−2
src/Servant/Client.hs+2−2
@@ -210,7 +210,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
210210 -- if mparam = Nothing, we don't add it to the query string
211211 clientWithRoute Proxy req mparam =
212212 clientWithRoute (Proxy :: Proxy sublayout) $
213− appendToQueryString pname mparamText req
213+ maybe req (flip (appendToQueryString pname) req . Just) mparamText
214214
215215 where pname = cs pname'
216216 pname' = symbolVal (Proxy :: Proxy sym)
@@ -251,7 +251,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
251251
252252 clientWithRoute Proxy req paramlist =
253253 clientWithRoute (Proxy :: Proxy sublayout) $
254− foldl' (\ value req' -> appendToQueryString pname req' value) req paramlist'
254+ foldl' (\ req' -> maybe req' (flip (appendToQueryString pname) req' . Just)) req paramlist'
255255
256256 where pname = cs pname'
257257 pname' = symbolVal (Proxy :: Proxy sym)