在我的android项目中,我使用Retrofit 2
@GET("/transfers/tunnels")
fun getTunnelsList(
@Query("destination[id]") destinationId: String,
@Query("amuunt") amount: Double,
@Query("currency") currency: String
): Call<List<Tunnel>>
结果如下:
-> GET http://my_ip/transfers/tunnels?destination%5Bid%5D=9eb5fd41-16f8-430c-91b7-a69ad1fd4c89&amuunt=4.0¤cy=EUR http/1.1
但是我需要名称为destination[id]
的参数
smt是这样的:
-> GET http://my_ip/sends?preferred_agent[id]=12345&amuunt=12.1¤cy=USD&receiver[id]=receiverID_guid&destination[id]=destinationId_guid&contract[id]=contractId_guid&is_ready=false
我该怎么做?
答案 0 :(得分:1)
您可以将encoded
注释的Query
参数设置为true
。然后它将按预期工作
@GET("/transfers/tunnels")
fun getTunnelsList(
@Query("destination[id]", encoded = true) destinationId: String,
@Query("amuunt") amount: Double,
@Query("currency") currency: String
): Call<List<Tunnel>>