【发布时间】:2016-12-28 11:37:32
【问题描述】:
所以我希望向我们的 api 发出请求以登录用户,但是有一个部分在 Retrofit 2 方法中被编码,即使它设置为encoded = true。基本网址是https://testapi.test.ie 我作为serverext 传递的参数是mdc.php?action= 但是即使在设置encoded = true 之后,生成的请求正文是:https://testapi.test.ie/mdc.php%3Faction=login_user&ts=1482924232742 我要求它是:https://testapi.test.ie/mdc.php?action=login_user&ts=1482924232742 所以我可以看到问题是? 符号。以下是我的改造方法,如果有人可以提供帮助,我将不胜感激,以实现正确的
@retrofit2.http.POST("/{serverext}login_user&ts={timestamp}")
@retrofit2.http.Multipart
Call<LoginResponseModel> loginUser(@retrofit2.http.Path(value = "serverext", encoded = true) String server,
@retrofit2.http.Part(Constants.USER) String username,
@retrofit2.http.Part(Constants.PASS) String password,
@retrofit2.http.Path("timestamp") Long timestamp);
【问题讨论】: