zoukankan      html  css  js  c++  java
  • 使用Retrofit时出现 java.lang.IllegalArgumentException: URL query string "t={type}&p={page}&size={count}" must not have replace block. For dynamic query parameters use @Query.异常原因

    /**
     * Created by leo on 16/4/30.
     */
    public interface GanchaiService {
        @GET("digest?t={type}&p={page}&size={count}")
        Call<List<GanChaiEntry>> ListGanchaiEntry(@Path("type") int type
                , @Path("count") int count, @Path("page") int page);
    }

    这里报错

    形如?t=1&p=2&size=3的url链接不能用@PATH注解

    Query params have their own annotation which automatically appends to the URL.

    使用@Query注解

        @GET("digest")
        Call<List<GanChaiEntry>> ListGanchaiEntry(@Query("t")int type
                , @Query("size") int count, @Query("p") int page);

    参考:

    http://stackoverflow.com/questions/24610243/retrofit-error-url-query-string-must-not-have-replace-block

  • 相关阅读:
    many2many
    oneselfone
    one2one
    10-many2one
    08-one2many
    05-curd
    动态SQl
    文件系统缓存dirty_ratio与dirty_background_ratio两个参数区别
    expect用法举例
    通过命令修改mysql的提示符
  • 原文地址:https://www.cnblogs.com/krislight1105/p/5452202.html
Copyright © 2011-2022 走看看