我对改造有疑问。它更改了我尝试访问的 URL。
我的界面是:
@GET("/movies/top_rated")
Call<ApiResponse<Movie>> getTopRatedMovies(@Query("api_key") String apiKey);
我的客户是:
public static final String BASE_URL = "http://api.themoviedb.org/3/";
private static Retrofit retrofit = null;
public static Retrofit getClient(){
if(retrofit == null){
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
我的问题是我想要从中检索数据的网站是
http://api.themoviedb.org/3/movies/top_rated?api_key=<<your_key>>
但 Retrofit 将其更改为
http://api.themoviedb.org/movies/top_rated?api_key=<<your_key>>
知道如何解决这个问题吗?
最佳答案
我认为你需要更换:
@GET("/movies/top_rated")
与:
@GET("movies/top_rated")
关于java - 改造更改 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40558414/