【发布时间】:2018-10-30 23:32:41
【问题描述】:
我在改装方面遇到了问题。
我的应用程序有一个名为Request 的按钮。当用户单击Request 按钮时,retrofit 会执行请求。
你能解释一下为什么改造不写第二个请求的所有数据吗?
有改造配置:
改造配置:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BuildConfig.API_BASE_URL)
.client(client)
.addConverterFactory(gson)
.addCallAdapterFactory(rxAdapter)
.build();
HttpClient
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
TokenInterceptor tokenInterceptor = new TokenInterceptor();
return new OkHttpClient.Builder()
.connectTimeout(20, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.addInterceptor(tokenInterceptor)
.addInterceptor(logging)
.cache(cache)
.build();
有来自改造的http日志:
- 第一次点击,改造写入155088字节正文,服务器返回403
-
第二次点击,改造不写所有数据(只有2023字节的正文)。客户端收到
Unable to resolve host错误。10-30 21:01:08.858 14479-14626/com.example.retrofit D/OkHttp: --> POST https://com.example.retrofit/v1/symptom/update/257http/1.1 (155088 字节正文)10-30 21:01:09.190 14479-14626/com.example.retrofit D/OkHttp: https://com.example.retrofit/v1/symptom/update/257 (332 毫秒,560 字节正文)10-30 21:01:23.109 14479-14573/com.example.retrofit D/OkHttp: --> POST https://com.example.retrofit/v1/symptom/update/257 http/1.1 (2023 字节 正文) 10-30 21:13:27.578 14479-14573/com.example.retrofit D/OkHttp:
【问题讨论】:
标签: android retrofit retrofit2