mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
optimize<Issue>: simplify crashreport logic while compiling with .NET 6
This commit is contained in:
parent
3628729a93
commit
37ce2cdba6
1 changed files with 4 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
@ -7,7 +8,6 @@ using System.Text.Json.Serialization;
|
|||
using System.Net.Http;
|
||||
#else
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
#endif
|
||||
|
||||
namespace SourceGit.Models {
|
||||
|
@ -46,11 +46,9 @@ namespace SourceGit.Models {
|
|||
e.StackTrace);
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
var req = new HttpClient();
|
||||
req.DefaultRequestHeaders.Add("Content-Type", "application/json");
|
||||
req.DefaultRequestHeaders.Add("charset", "UTF-8");
|
||||
req.Timeout = TimeSpan.FromSeconds(1);
|
||||
req.PostAsync("https://gitee.com/api/v5/repos/sourcegit/issues", new StringContent(JsonSerializer.Serialize(issue))).Wait();
|
||||
var content = new StringContent(JsonSerializer.Serialize(issue), Encoding.UTF8, "application/json");
|
||||
var req = new HttpClient() { Timeout = TimeSpan.FromSeconds(1) };
|
||||
req.PostAsync("https://gitee.com/api/v5/repos/sourcegit/issues", content).Wait();
|
||||
#else
|
||||
var req = WebRequest.CreateHttp("https://gitee.com/api/v5/repos/sourcegit/issues");
|
||||
req.Method = "POST";
|
||||
|
|
Loading…
Reference in a new issue