【发布时间】:2020-11-30 02:22:59
【问题描述】:
是否可以在运行时动态传递绝对 url 进行改造?
例如,我访问了一个返回用户列表的 Rest API,并为分页提供了一个用于检索更多项目的绝对 url:
{
"result": [
{
"id": 1,
"name": "Daniel"
},
{
"id": 2,
"name": "Michael"
},
{
"id": 3,
"name": "Chris"
}
],
"pagination": "http://www.foo.com/users?offset=3"
}
Retrofit https://github.com/square/retrofit/issues/333好像不支持
是否有一种仅适用于单个RestAdapter 的解决方法?
【问题讨论】:
-
看起来 Retrofit 并不是为这个(非常简单的)用例而设计的。 Jake Wharton 在您链接的问题中的comment 似乎总结了这一点:“我真的,真的 不想支持这个”。例如 Volley 更适合获取绝对 URL。
-
@GET Call
getUsers(@Url String url);见enter link description here