完成了小水滴的Marker样式分类绘制
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user