我得到空响应代替值。
我的 json 响应是
{
"resonse": {
"status": 200,
"result": [
{
"video_id": "3c19979979",
"video_title": "Sushil Kumar Modi press conference after serial bomb blasts at Modi rally in Patna",
"video_description": "BJP at Patna serial blast in Bihar, Nitish government has stood in the dock. Former Deputy Chief Minister Sushil Kumar Modi said the blasts Narendra Modi were targeted. He said that Nitish Kumar look Modi as the enemy.<br />\r\n",
"video_poster": "https://vbcdn.com/cdn/download/2013102913830306761810268995.jpg",
"video_duration": "02:02",
"video_category": "News/Politics",
}
]}
}
改造客户端:
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request newRequest = chain.request().newBuilder()
.addHeader("Authorization", "Bearer " + token)
.build();
return chain.proceed(newRequest);
}
}).build();
if (retrofit==null)
retrofit = new Retrofit.Builder()
.baseUrl(API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
return retrofit;
每当我调用 api 时,状态码为 200,但响应主体始终为空。我收到的消息是这样的:
响应{protocol=h2, code=200, message=, url= https://api.com/video/list-video.php }
紫衣仙女
qq_遁去的一_1
慕雪6442864
相关分类