【发布时间】:2013-11-02 16:24:54
【问题描述】:
我正在使用 Square 的 Retrofit 库。我需要使用可变数量的参数来实现请求。我找到了建议 (link),我试试这个:
我变了
@GET("someURL")
void method(
@Query("firstParameter") int firstValue,
@Query("secondParameter") String secondValue,
Callback<Response> cb
);
到
@POST("someURL")
void method(
@Body Map<String, Object> parameters,
Callback<Response> cb
);
并使用跟随:
final HashMap<String, Object> param = new HashMap<String, Object>();
param.put("firstParameter", firstValue);
param.put("secondParameter", secondValue);
第一种方法很好用,但第二种方法不行。怎么了?
【问题讨论】: