java - Retrofit 2 - URL Query Parameter -
i using query parameters set values needed google maps api.
the issue not need &
sign first query parameter.
@get("/maps/api/geocode/json?") call<jsonobject> getlocationinfo(@query("address") string zipcode, @query("sensor") boolean sensor, @query("client") string client, @query("signature") string signature);
retrofit generates:
&address=90210&sensor=false&client=gme-client&signature=signkey
which causes call fail when need be
address=90210&sensor=false&client=gme-client&signature=signkey
how fix this?
if specify @get("foobar?a=5")
, @query("b")
must appended using &
, producing foobar?a=5&b=7
.
if specify @get("foobar")
, first @query
must appended using ?
, producing foobar?b=7
.
that's how retrofit works.
when specify @get("foobar?")
, retrofit thinks gave query parameter, , appends more query parameters using &
.
remove ?
, , desired result.
Comments
Post a Comment