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 77using System . Net . Http ;
88using System . Security . Cryptography ;
99using System . Text . RegularExpressions ;
10+ using System . Threading ;
1011using System . Threading . Tasks ;
1112using Xunit ;
1213using Xunit . Abstractions ;
@@ -38,7 +39,7 @@ public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck()
3839 Assert . NotEmpty ( scriptTags ) ;
3940
4041 var shasum = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
41- using ( var client = new HttpClient ( ) )
42+ using ( var client = new HttpClient ( new RetryHandler ( new HttpClientHandler ( ) { } ) ) )
4243 {
4344 foreach ( var script in scriptTags )
4445 {
@@ -62,6 +63,25 @@ public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck()
6263 } ) ;
6364 }
6465
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+
6585 private struct ScriptTag
6686 {
6787 public string Src ;
You can’t perform that action at this time.
0 commit comments