mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update Proxy every time calling a http request method since the proxy setting won't update automatically without action
This commit is contained in:
parent
96609f797e
commit
5ab8c4faa3
1 changed files with 10 additions and 1 deletions
|
|
@ -47,7 +47,14 @@ namespace Flow.Launcher.Infrastructure.Http
|
|||
}
|
||||
}
|
||||
|
||||
public static WebProxy WebProxy { get; private set; } = new WebProxy();
|
||||
private static WebProxy _proxy = new WebProxy();
|
||||
public static WebProxy WebProxy {
|
||||
get
|
||||
{
|
||||
UpdateProxy();
|
||||
return _proxy;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the Address of the Proxy to modify the client Proxy
|
||||
|
|
@ -77,6 +84,7 @@ namespace Flow.Launcher.Infrastructure.Http
|
|||
|
||||
public static async Task Download([NotNull] string url, [NotNull] string filePath)
|
||||
{
|
||||
UpdateProxy();
|
||||
using var response = await client.GetAsync(url);
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
|
|
@ -91,6 +99,7 @@ namespace Flow.Launcher.Infrastructure.Http
|
|||
|
||||
public static async Task<string> Get([NotNull] string url, string encoding = "UTF-8")
|
||||
{
|
||||
UpdateProxy();
|
||||
Log.Debug($"|Http.Get|Url <{url}>");
|
||||
var response = await client.GetAsync(url);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync();
|
||||
|
|
|
|||
Loading…
Reference in a new issue