File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
src/Identity/test/Identity.Test Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 7
7
using System . Net . Http ;
8
8
using System . Security . Cryptography ;
9
9
using System . Text . RegularExpressions ;
10
+ using System . Threading ;
10
11
using System . Threading . Tasks ;
11
12
using Xunit ;
12
13
using Xunit . Abstractions ;
@@ -38,7 +39,7 @@ public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck()
38
39
Assert . NotEmpty ( scriptTags ) ;
39
40
40
41
var shasum = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
41
- using ( var client = new HttpClient ( ) )
42
+ using ( var client = new HttpClient ( new RetryHandler ( new HttpClientHandler ( ) { } ) ) )
42
43
{
43
44
foreach ( var script in scriptTags )
44
45
{
@@ -62,6 +63,25 @@ public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck()
62
63
} ) ;
63
64
}
64
65
66
+ class RetryHandler : DelegatingHandler
67
+ {
68
+ public RetryHandler ( HttpMessageHandler innerHandler ) : base ( innerHandler ) { }
69
+ protected override async Task < HttpResponseMessage > SendAsync ( HttpRequestMessage request , CancellationToken cancellationToken )
70
+ {
71
+ HttpResponseMessage result = null ;
72
+ for ( var i = 0 ; i < 10 ; i ++ )
73
+ {
74
+ result = await base . SendAsync ( request , cancellationToken ) ;
75
+ if ( result . IsSuccessStatusCode )
76
+ {
77
+ return result ;
78
+ }
79
+ await Task . Delay ( 1000 ) ;
80
+ }
81
+ return result ;
82
+ }
83
+ }
84
+
65
85
private struct ScriptTag
66
86
{
67
87
public string Src ;
You can’t perform that action at this time.
0 commit comments