Android Retrofit会附加不需要的字符

时间:2017-03-30 11:20:17

标签: android json retrofit2

我正在尝试对json文件执行GET请求:

https://www.someurl.com/appconfiguration.json

所以我使用以下GET方法创建了一个接口

  @GET("appconfiguration.json}")
  Call<AppConfigParent> loadAppConfigParent();

并将其称为:

   final MMSATServices.AppConfigResponse appConfigResponse = new MMSATServices.AppConfigResponse();
    appConfigResponse.appConfigParent = new AppConfigParent();
    appConfigResponse.appConfigParent.configuration = null;

    Call<AppConfigParent> call = api.loadAppConfigParent();
    call.enqueue(new Callback<AppConfigParent>() {
        @Override
        public void onResponse(Call<AppConfigParent> call, Response<AppConfigParent> response) {
            appConfigResponse.appConfigParent.configuration = response.body().configuration;
            bus.post(appConfigResponse);
        }

        @Override
        public void onFailure(Call<AppConfigParent> call, Throwable t) {

        }
    });

请注意,api对象是接口的实例,在超类中定义。

实际问题是我得到了404回复:

请求{method = GET,url = https://someurl.com/appconfiguration.json%7D,tag =请求{method = GET,url = https://someurl.com/appconfiguration.json%7D,tag = null}}

如您所见,%7D附加到网址,导致404错误。我怎样才能摆脱这种行为?

1 个答案:

答案 0 :(得分:2)

删除}

中的@GET("appconfiguration.json}")
相关问题