コード例 #1
0
        async public static Task <ResponseInfo> GetResponseInfo(this HttpWebResponse response)
        {
            var info = new ResponseInfo();

            info.Status      = (int)response.StatusCode;
            info.StatusText  = response.StatusDescription;
            info.HttpVersion = response.ProtocolVersion.ToString();

            //info.Cookies = await response.Cookies.GetCookieInfo();
            info.Headers = await response.GetHeaderInfo();

            info.Content = await response.GetContentInfo();

            if (response.ResponseUri != null)
            {
                info.RedirectUrl = response.ResponseUri.OriginalString;
            }
            //TODO: HeadersSize
            //TODO: BodySize
            info.Comment = "HttpResponseMessage";
            return(info);
        }