Skip to content

Commit

Permalink
Core - DownloadUrlAsync add optional UrlReqestFlags param
Browse files Browse the repository at this point in the history
Discussion #4578
  • Loading branch information
amaitland committed Aug 25, 2023
1 parent c09f100 commit 2e2b53f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CefSharp.Core/WebBrowserExtensionsEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ public static void DownloadUrl(this IFrame frame, string url, Action<IUrlRequest
/// </summary>
/// <param name="frame">valid frame</param>
/// <param name="url">url to download</param>
/// <param name="urlRequestFlags">control caching policy</param>
/// <returns>A task that can be awaited to get the <see cref="T:byte[]"/> representing the Url</returns>
public static Task<byte[]> DownloadUrlAsync(this IFrame frame, string url)
public static Task<byte[]> 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.");
Expand All @@ -116,6 +122,7 @@ public static Task<byte[]> DownloadUrlAsync(this IFrame frame, string url)

request.Method = "GET";
request.Url = url;
request.Flags = urlRequestFlags;

var memoryStream = new MemoryStream();

Expand Down

0 comments on commit 2e2b53f

Please sign in to comment.