chore: 减少不必要的序列化

oneRain 2020-09-02 17:19:21 +08:00
parent 374e7ef4ae
commit 18bc1c3fbb
1 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,9 @@ using System.Net.Http;
namespace LeanCloud.Common { namespace LeanCloud.Common {
public static class LCHttpUtils { public static class LCHttpUtils {
public static void PrintRequest(HttpClient client, HttpRequestMessage request, string content = null) { public static void PrintRequest(HttpClient client, HttpRequestMessage request, string content = null) {
if (LCLogger.LogDelegate == null) {
return;
}
if (client == null) { if (client == null) {
return; return;
} }
@ -35,6 +38,9 @@ namespace LeanCloud.Common {
} }
public static void PrintResponse(HttpResponseMessage response, string content = null) { public static void PrintResponse(HttpResponseMessage response, string content = null) {
if (LCLogger.LogDelegate == null) {
return;
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine("=== HTTP Response Start ==="); sb.AppendLine("=== HTTP Response Start ===");
sb.AppendLine($"URL: {response.RequestMessage.RequestUri}"); sb.AppendLine($"URL: {response.RequestMessage.RequestUri}");