Hi,
when I use GET method to request, always occurs a error"baseUrl must end in /", I don't know it's my fault or bug.
APIService
@GET Call<T> getDesignerList();Java Code
`
url += "&sign=" + generateSign(url, null) + "/";
LogUtil.i("url===" + url);
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(url)
.build();
APIService apiService = retrofit.create(APIService.class);
Call<T> call = apiService.getDesignerList();
`
It is true when I print url to Log Window, and I can get data from browser and the url end is /.
PS: The format of my url:
http://192.168.1.2/travel/designerList?page=1&appver=&sysver=android&network=&res=&did=&mac=&token=&sign=xxx&mfr=SM-N9006/
You should not be setting a full endpoint URL as the base URL. I guess we should add another check for non-empty query params and non-empty fragments.
In this case, your base URL is http://192.168.1.2/ and the relative URL that should go inside of the @GET annotation is travel/designerList?page=1&appver=&sysver=android&network=&res=&did=&mac=&token=&sign=xxx&mfr=SM-N9006/
It resolved my problem. @JakeWharton thank you very much!
@JakeWharton It solved My problem Too, Thank You
Most helpful comment
You should not be setting a full endpoint URL as the base URL. I guess we should add another check for non-empty query params and non-empty fragments.
In this case, your base URL is
http://192.168.1.2/and the relative URL that should go inside of the@GETannotation istravel/designerList?page=1&appver=&sysver=android&network=&res=&did=&mac=&token=&sign=xxx&mfr=SM-N9006/