コード例 #1
0
        internal static bool IsText(HttpResponseMessage response)
        {
            // ContentType may not exist in response header.
            string contentType = response.Content.Headers.ContentType?.MediaType;

            return(ContentHelper.IsText(contentType));
        }
コード例 #2
0
 private void InitializeContent()
 {
     if (ContentHelper.IsText(ContentHelper.GetContentType(base.BaseResponse)))
     {
         string characterSet = WebResponseHelper.GetCharacterSet(base.BaseResponse);
         this.Content = StreamHelper.DecodeStream(base.RawContentStream, characterSet);
     }
     else
     {
         this.Content = string.Empty;
     }
 }
コード例 #3
0
        /// <summary>
        /// Reads the response content from the web response.
        /// </summary>
        private void InitializeContent()
        {
            string contentType = ContentHelper.GetContentType(BaseResponse);

            if (ContentHelper.IsText(contentType))
            {
                // fill the Content buffer
                string characterSet = WebResponseHelper.GetCharacterSet(BaseResponse);
                this.Content = StreamHelper.DecodeStream(RawContentStream, characterSet);
            }
            else
            {
                this.Content = string.Empty;
            }
        }
コード例 #4
0
        /// <summary>
        /// Reads the response content from the web response.
        /// </summary>
        protected void InitializeContent()
        {
            string contentType = ContentHelper.GetContentType(BaseResponse);

            if (ContentHelper.IsText(contentType))
            {
                Encoding encoding = null;
                // fill the Content buffer
                string characterSet = WebResponseHelper.GetCharacterSet(BaseResponse);
                this.Content  = StreamHelper.DecodeStream(RawContentStream, characterSet, out encoding);
                this.Encoding = encoding;
            }
            else
            {
                this.Content = string.Empty;
            }
        }
コード例 #5
0
        internal static bool IsText(WebResponse response)
        {
            string contentType = ContentHelper.GetContentType(response);

            return(ContentHelper.IsText(contentType));
        }
コード例 #6
0
        internal static bool IsText(HttpResponseMessage response)
        {
            string contentType = response.Content.Headers.ContentType.MediaType;

            return(ContentHelper.IsText(contentType));
        }
コード例 #7
0
 internal static bool IsText(WebResponse response)
 {
     return(ContentHelper.IsText(ContentHelper.GetContentType(response)));
 }