private static async Task ParseHttpResponseAsync()

in aliyun-net-credentials/Http/HttpResponse.cs [56:77]


        private static async Task ParseHttpResponseAsync(HttpResponse httpResponse, HttpWebResponse httpWebResponse)
        {
            httpResponse.Content = await ReadContentAsync(httpWebResponse);
            httpResponse.Status = (int)httpWebResponse.StatusCode;
            httpResponse.Headers = new Dictionary<string, string>();
            httpResponse.Method = ParameterHelper.StringToMethodType(httpWebResponse.Method);

            foreach (var key in httpWebResponse.Headers.AllKeys)
            {
                httpResponse.Headers.Add(key, httpWebResponse.Headers[key]);
            }

            var contentType = DictionaryUtil.Get(httpResponse.Headers, "Content-Type");

            if (null == contentType) return;
            httpResponse.Encoding = "UTF-8";
            var split = contentType.Split(';');
            httpResponse.ContentType = ParameterHelper.StingToFormatType(split[0].Trim());
            if (split.Length <= 1 || !split[1].Contains("=")) return;
            var codings = split[1].Split('=');
            httpResponse.Encoding = codings[1].Trim().ToUpper();
        }