File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
using RestSharp ;
2
2
using System ;
3
3
using System . Net ;
4
+ using System . Threading . Tasks ;
4
5
using TbsCore . Models . Access ;
5
6
using TbsCore . Models . AccModels ;
6
7
@@ -24,10 +25,20 @@ public static CookieContainer GetCookies(Account acc)
24
25
return cookieContainer ;
25
26
}
26
27
28
+ public static async Task < string > SendPostReqAsync ( Account acc , RestRequest req )
29
+ {
30
+ acc . Wb . RestClient . BaseUrl = new Uri ( acc . AccInfo . ServerUrl ) ;
31
+ acc . Wb . RestClient . CookieContainer = GetCookies ( acc ) ;
32
+
33
+ var response = await acc . Wb . RestClient . ExecuteAsync ( req ) ;
34
+ if ( response . StatusCode != HttpStatusCode . OK ) throw new Exception ( "SendGetReq failed!\n " + response . Content ) ;
35
+
36
+ return response . Content ;
37
+ }
27
38
public static string SendPostReq ( Account acc , RestRequest req )
28
39
{
29
40
acc . Wb . RestClient . BaseUrl = new Uri ( acc . AccInfo . ServerUrl ) ;
30
- acc . Wb . RestClient . CookieContainer = HttpHelper . GetCookies ( acc ) ;
41
+ acc . Wb . RestClient . CookieContainer = GetCookies ( acc ) ;
31
42
32
43
var response = acc . Wb . RestClient . Execute ( req ) ;
33
44
if ( response . StatusCode != HttpStatusCode . OK ) throw new Exception ( "SendGetReq failed!\n " + response . Content ) ;
Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ public override async Task<TaskRes> Execute(Account acc)
202
202
{
203
203
lastSent = DateTime . Now ;
204
204
acc . Logger . Information ( $ "{ DateTime . Now . Second } .{ DateTime . Now . Millisecond } ] Sending wave { i + 1 } ") ;
205
- _ = HttpHelper . SendPostReq ( acc , wavesReady [ i ] . Request ) ;
205
+ _ = HttpHelper . SendPostReqAsync ( acc , wavesReady [ i ] . Request ) ;
206
206
207
207
// Wait +- 10% selected delay
208
208
var delay = SendWaveModels [ i ] . DelayMs ;
You can’t perform that action at this time.
0 commit comments