@@ -560,13 +560,28 @@ public async Task Caching_SetTtlAndStatusCode_Cached()
560
560
context . Response . CacheTtl = TimeSpan . FromSeconds ( 10 ) ;
561
561
context . Dispose ( ) ;
562
562
563
- var response = await responseTask ;
563
+ HttpResponseMessage response ;
564
+ try
565
+ {
566
+ response = await responseTask ;
567
+ }
568
+ catch ( Exception ex )
569
+ {
570
+ throw new Exception ( $ "Failed to get first response for { status } ", ex ) ;
571
+ }
564
572
Assert . Equal ( status , ( int ) response . StatusCode ) ;
565
573
Assert . Equal ( status . ToString ( ) , response . Headers . GetValues ( "x-request-count" ) . FirstOrDefault ( ) ) ;
566
574
Assert . Equal ( new byte [ 0 ] , await response . Content . ReadAsByteArrayAsync ( ) ) ;
567
575
568
576
// Send a second request and make sure we get the same response (without listening for one on the server).
569
- response = await SendRequestAsync ( address + status ) ;
577
+ try
578
+ {
579
+ response = await SendRequestAsync ( address + status ) ;
580
+ }
581
+ catch ( Exception ex )
582
+ {
583
+ throw new Exception ( $ "Failed to get second response for { status } ", ex ) ;
584
+ }
570
585
Assert . Equal ( status , ( int ) response . StatusCode ) ;
571
586
Assert . Equal ( status . ToString ( ) , response . Headers . GetValues ( "x-request-count" ) . FirstOrDefault ( ) ) ;
572
587
Assert . Equal ( new byte [ 0 ] , await response . Content . ReadAsByteArrayAsync ( ) ) ;
@@ -1137,7 +1152,7 @@ private async Task<HttpResponseMessage> SendRequestAsync(string uri, string meth
1137
1152
{
1138
1153
using ( var handler = new HttpClientHandler ( ) { AllowAutoRedirect = false } )
1139
1154
{
1140
- using ( var client = new HttpClient ( handler ) { Timeout = TimeSpan . FromSeconds ( 5 ) } )
1155
+ using ( var client = new HttpClient ( handler ) { Timeout = Utilities . DefaultTimeout } )
1141
1156
{
1142
1157
var request = new HttpRequestMessage ( new HttpMethod ( method ) , uri ) ;
1143
1158
if ( ! string . IsNullOrEmpty ( extraHeader ) )
0 commit comments