File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Reflection ;
3
+ using System . Text ;
3
4
using System . Text . Json ;
4
5
using System . Text . Json . Serialization ;
5
6
6
7
#if NET6_0_OR_GREATER
7
8
using System . Net . Http ;
8
9
#else
9
10
using System . Net ;
10
- using System . Text ;
11
11
#endif
12
12
13
13
namespace SourceGit . Models {
@@ -46,11 +46,9 @@ public static void Create(System.Exception e) {
46
46
e . StackTrace ) ;
47
47
48
48
#if NET6_0_OR_GREATER
49
- var req = new HttpClient ( ) ;
50
- req . DefaultRequestHeaders . Add ( "Content-Type" , "application/json" ) ;
51
- req . DefaultRequestHeaders . Add ( "charset" , "UTF-8" ) ;
52
- req . Timeout = TimeSpan . FromSeconds ( 1 ) ;
53
- req . PostAsync ( "https://gitee.com/api/v5/repos/sourcegit/issues" , new StringContent ( JsonSerializer . Serialize ( issue ) ) ) . Wait ( ) ;
49
+ var content = new StringContent ( JsonSerializer . Serialize ( issue ) , Encoding . UTF8 , "application/json" ) ;
50
+ var req = new HttpClient ( ) { Timeout = TimeSpan . FromSeconds ( 1 ) } ;
51
+ req . PostAsync ( "https://gitee.com/api/v5/repos/sourcegit/issues" , content ) . Wait ( ) ;
54
52
#else
55
53
var req = WebRequest . CreateHttp ( "https://gitee.com/api/v5/repos/sourcegit/issues" ) ;
56
54
req . Method = "POST" ;
You can’t perform that action at this time.
0 commit comments