Skip to content

Commit

Permalink
Code quality improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
VoidXH committed Sep 4, 2024
1 parent be029a7 commit f69b565
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions CavernSamples/VoidX.WPF/HTTP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public static string GET(string url, int timeoutSeconds = 5) {
if (response.IsSuccessStatusCode) {
return response.Content.ReadAsStringAsync().Result;
}
} catch { }
} catch {
return null;
}
return null;
}

Expand Down Expand Up @@ -49,7 +51,7 @@ public static string POST(string url, (string key, byte[] value)[] data, int tim
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string POST(string url, HttpContent content, int timeoutSeconds = 5) {
using HttpClient client = new HttpClient() {
using HttpClient client = new HttpClient {
Timeout = TimeSpan.FromSeconds(timeoutSeconds)
};
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url) {
Expand All @@ -60,7 +62,9 @@ public static string POST(string url, HttpContent content, int timeoutSeconds =
if (response.IsSuccessStatusCode) {
return response.Content.ReadAsStringAsync().Result;
}
} catch { }
} catch {
return null;
}
return null;
}
}
Expand Down

0 comments on commit f69b565

Please sign in to comment.