public async Task SendAsync()

in SDK/AppCenter/Microsoft.AppCenter.Windows.Shared/Ingestion/Http/HttpNetworkAdapter.cs [58:101]


        public async Task<string> SendAsync(string uri, string method, IDictionary<string, string> headers, string jsonContent, CancellationToken cancellationToken)
        {
            using (var request = CreateRequest(uri, method, headers, jsonContent))
            using (var response = await SendRequestAsync(request, cancellationToken).ConfigureAwait(false))
            {
                if (response == null)
                {
                    throw new IngestionException("Null response received");
                }
                var responseContent = "(null)";
                string contentType = null;
                if (response.Content != null)
                {
                    responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                    if (response.Content.Headers.TryGetValues("Content-Type", out var contentTypeHeaders))
                    {
                        contentType = contentTypeHeaders.FirstOrDefault();
                    }
                }
                string logPayload;
                if (contentType == null || contentType.StartsWith("text/") || contentType.StartsWith("application/"))
                {
                    logPayload = responseContent;
                }
                else
                {
                    logPayload = "<binary>";
                }
                var logMessage = $"HTTP response status={(int)response.StatusCode} ({response.StatusCode}) payload={logPayload}";
                AppCenterLog.Verbose(AppCenterLog.LogTag, logMessage);
                if ((int)response.StatusCode < 200 || (int)response.StatusCode >= 300)
                {
                    throw new HttpIngestionException(logMessage)
                    {
                        Method = request.Method.ToString(),
                        RequestUri = request.RequestUri,
                        StatusCode = (int)response.StatusCode,
                        RequestContent = jsonContent,
                        ResponseContent = responseContent
                    };
                }
                return responseContent;
            }
        }