From 0f431471cdd358c234b8a9ba67ce5eac51a93d09 Mon Sep 17 00:00:00 2001 From: Cory Date: Mon, 16 Mar 2020 15:17:46 -0500 Subject: [PATCH] core: refactor http webclient part 6 #8529 (#7690) Add implicit string result conversion --- src/Jackett.Common/Utils/Clients/WebClientResult.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Jackett.Common/Utils/Clients/WebClientResult.cs b/src/Jackett.Common/Utils/Clients/WebClientResult.cs index 360e50832..5641b58bf 100644 --- a/src/Jackett.Common/Utils/Clients/WebClientResult.cs +++ b/src/Jackett.Common/Utils/Clients/WebClientResult.cs @@ -3,5 +3,17 @@ namespace Jackett.Common.Utils.Clients public class WebClientStringResult : BaseWebResult { public string ContentString { get; set; } + + public static implicit operator WebClientStringResult(WebClientByteResult br) => new WebClientStringResult() + { + ContentString = br.Encoding.GetString(br.ContentBytes), + Cookies = br.Cookies, + Encoding = br.Encoding, + Headers = br.Headers, + RedirectingTo = br.RedirectingTo, + Request = br.Request, + Status = br.Status + }; + } }