Retrofit中的IllegalArgumentException/不能具有replace块 [英] IllegalArgumentException in Retrofit / must not have replace block
本文介绍了Retrofit中的IllegalArgumentException/不能具有replace块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码:
@GET("api.php?company_name={name}")
Call<Model> getRoms_center(@Query("name") String name);
根据官方文档,我必须使用@Query,并且我正在使用它,但出现以下错误:
According to the official docs, I must use @Query, and i'm using it, but i'm getting the following error :
java.lang.IllegalArgumentException: URL query string "company_name={name}" must not have replace block. For dynamic query parameters use @Query.
推荐答案
您应该这样做:
@GET("api.php")
Call<Model> getRoms_center(@Query("company_name") String name);
这篇关于Retrofit中的IllegalArgumentException/不能具有replace块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文