예제 #1
0
        async public static Task <ResponseInfo> GetResponseInfo(this HttpResponseMessage message)
        {
            var info = new ResponseInfo();

            info.Status      = (int)message.StatusCode;
            info.StatusText  = message.ToString();
            info.HttpVersion = message.Version.ToString();
            //TODO: SetCookies(message);
            //TODO: SetHeaders(message);
            //TODO: SetContent(message);
            if (message.Headers.Location != null)
            {
                info.RedirectUrl = message.Headers.Location.OriginalString;
            }
            //TODO: HeadersSize
            //TODO: BodySize
            info.Comment = "HttpResponseMessage";
            return(info);
        }
예제 #2
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);
        }