更新时间:2023-11-26 21:35:40
如果你指定 @GET(foobar?a = 5)
,那么任何 @Query(b)
必须使用&
附加,产生类似 foobar?a = 5& b = 7
。
If you specify @GET("foobar?a=5")
, then any @Query("b")
must be appended using &
, producing something like foobar?a=5&b=7
.
如果指定 @GET(foobar)
,然后必须使用?
附加第一个 @Query
,产生类似 foobar的东西? b = 7
。
If you specify @GET("foobar")
, then the first @Query
must be appended using ?
, producing something like foobar?b=7
.
这就是Retrofit的工作方式。
That's how Retrofit works.
当你指定 @GET(foobar?)
,Retrofit认为你已经提供了一些查询参数,并且appen ds more 查询参数使用&
。
When you specify @GET("foobar?")
, Retrofit thinks you already gave some query parameter, and appends more query parameters using &
.
删除?
,您将获得所需的结果。
Remove the ?
, and you will get the desired result.