Exemple #1
0
        internal static Task <Tuple <HttpStatusCode, string> > RequestAsync(Uri uri, string method, IList <KeyValuePair <string, string> > headers, Stream data, string contentType, CancellationToken cancellationToken)
        {
            HttpRequest request = new HttpRequest()
            {
                Data    = data,
                Headers = headers,
                Method  = method,
                Uri     = uri
            };

            if (AVClient.httpDebugLog)
            {
                AVClient.LogTracker("---BEGIN---");
                AVClient.LogTracker("---headers---");
                foreach (var h in headers)
                {
                    AVClient.LogTracker(h.Key + " : " + h.Value.ToString());
                }
                AVClient.LogTracker("---headers---");
                AVClient.LogTracker("url: " + uri.ToString());
                AVClient.LogTracker("method: " + method);
                AVClient.LogTracker("body: " + data);
                AVClient.LogTracker("---END---");
            }

            return(AVClient.PlatformHooks.HttpClient.ExecuteAsync(request, null, null, CancellationToken.None));
        }
Exemple #2
0
 /// <summary>
 /// 打印 HTTP 访问日志
 /// </summary>
 /// <param name="log"></param>
 public static void PrintLog(string log)
 {
     if (AVClient.LogTracker != null)
     {
         AVClient.LogTracker(log);
     }
 }