internal static bool IsText(HttpResponseMessage response) { // ContentType may not exist in response header. string contentType = response.Content.Headers.ContentType?.MediaType; return(ContentHelper.IsText(contentType)); }
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; } }
/// <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; } }
/// <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; } }
internal static bool IsText(WebResponse response) { string contentType = ContentHelper.GetContentType(response); return(ContentHelper.IsText(contentType)); }
internal static bool IsText(HttpResponseMessage response) { string contentType = response.Content.Headers.ContentType.MediaType; return(ContentHelper.IsText(contentType)); }
internal static bool IsText(WebResponse response) { return(ContentHelper.IsText(ContentHelper.GetContentType(response))); }