From 2e2b53f8a1a3ee4839c7d1d18be8fa8b0269139f Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sat, 26 Aug 2023 07:46:25 +1000 Subject: [PATCH] Core - DownloadUrlAsync add optional UrlReqestFlags param Discussion #4578 --- CefSharp.Core/WebBrowserExtensionsEx.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CefSharp.Core/WebBrowserExtensionsEx.cs b/CefSharp.Core/WebBrowserExtensionsEx.cs index 537f7cba33..d6d770f189 100644 --- a/CefSharp.Core/WebBrowserExtensionsEx.cs +++ b/CefSharp.Core/WebBrowserExtensionsEx.cs @@ -99,9 +99,15 @@ public static void DownloadUrl(this IFrame frame, string url, Action /// valid frame /// url to download + /// control caching policy /// A task that can be awaited to get the representing the Url - public static Task DownloadUrlAsync(this IFrame frame, string url) + public static Task DownloadUrlAsync(this IFrame frame, string url, UrlRequestFlags urlRequestFlags = UrlRequestFlags.None) { + if (frame == null) + { + throw new ArgumentNullException(nameof(frame)); + } + if (!frame.IsValid) { throw new Exception("Frame is invalid, unable to continue."); @@ -116,6 +122,7 @@ public static Task DownloadUrlAsync(this IFrame frame, string url) request.Method = "GET"; request.Url = url; + request.Flags = urlRequestFlags; var memoryStream = new MemoryStream();