完成了小水滴的Marker样式分类绘制

This commit is contained in:
董宏宇
2020-01-14 19:03:02 +08:00
parent 6acdfa3772
commit 58456245f7
10 changed files with 106 additions and 61 deletions

View File

@@ -3,12 +3,15 @@ package com.mogo.utils.network;
import com.mogo.utils.logger.Logger;
import java.io.IOException;
import java.nio.charset.Charset;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okio.Buffer;
final class RequestLogInterceptor implements Interceptor {
@@ -33,9 +36,26 @@ final class RequestLogInterceptor implements Interceptor {
logMsg.append(request.url()).append("\r\n");
if(hasRequestBody){
logMsg.append("Content-Type: ").append(requestBody.contentType()).append(", ");
logMsg.append("Content-Length: ").append(requestBody.contentLength());
logMsg.append("\r\nContent-Length: ").append(requestBody.contentLength());
try {
String body = null;
Charset UTF8 = Charset.forName("UTF-8");
Buffer buffer = new Buffer();
requestBody.writeTo(buffer);
Charset charset = UTF8;
MediaType contentType = requestBody.contentType();
if (contentType != null) {
charset = contentType.charset(UTF8);
}
if (charset != null) {
body = buffer.readString(charset);
}
logMsg.append("\r\nContent-body: ").append(body);
} catch (IOException e) {
e.printStackTrace();
}
}
logMsg.append(" <-- end http request");
logMsg.append("\r\n<-- end http request");
if(NetConfig.instance().isLoggable()){
Logger.d(TAG, logMsg.toString());