diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-05 03:25:53 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-05 03:25:53 +0200 |
commit | 51d820e22a4517dbb06d38a4f07f7c48522ef811 (patch) | |
tree | 4a7749cf77223dff2414fd4b73cb17df43d7449e /LibGit/Extensions/HttpClientExtensions.cs | |
download | GitTools-master.tar.xz |
Diffstat (limited to 'LibGit/Extensions/HttpClientExtensions.cs')
-rw-r--r-- | LibGit/Extensions/HttpClientExtensions.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/LibGit/Extensions/HttpClientExtensions.cs b/LibGit/Extensions/HttpClientExtensions.cs new file mode 100644 index 0000000..79e3e5f --- /dev/null +++ b/LibGit/Extensions/HttpClientExtensions.cs @@ -0,0 +1,19 @@ +namespace LibGit.Extensions; + +public static class HttpClientExtensions +{ + public static async Task<bool> CheckSuccessStatus(this HttpClient hc, string url) + { + //cors causes failure, try to catch + try + { + var resp = await hc.GetAsync(url); + return resp.IsSuccessStatusCode; + } + catch (Exception e) + { + Console.WriteLine($"Failed to check success status: {e.Message}"); + return false; + } + } +} \ No newline at end of file |