1
我有OkHttpClient 2.7和來自Square的HttpLoggingInterceptor 2.7。我創建了返回json的「GET」請求,但由於某種原因,響應主體未被記錄,響應主體的結果僅爲「}」。所有其他東西,如標題,內容類型等都存在於控制檯中。 logger.log(buffer.clone()readString(字符集)。);:由於某種原因,HttpLoggingInterceptor沒有爲OkHttp正文記錄響應
HttpLoggHttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
mHttpClient.interceptors().add(interceptor);
的問題應在該字符串
--> END GET
<-- HTTP/1.1 200 OK (420ms)
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true
Expires: -1
Server: Microsoft-IIS/8.5
OData-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 24 Dec 2015 17:51:42 GMT
Content-Length: 2291
OkHttp-Sent-Millis: 1450979490431
OkHttp-Received-Millis: 1450979490851
}