@@ -30,7 +30,7 @@ protected static class InstrumentNames
30
30
public const string ConnectionDuration = "http.client.connection.duration" ;
31
31
public const string TimeInQueue = "http.client.request.time_in_queue" ;
32
32
}
33
-
33
+
34
34
protected HttpMetricsTestBase ( ITestOutputHelper output ) : base ( output )
35
35
{
36
36
}
@@ -347,7 +347,7 @@ public Task RequestDuration_CustomTags_Recorded()
347
347
{
348
348
ctx . AddCustomTag ( "route" , "/test" ) ;
349
349
} ) ;
350
-
350
+
351
351
using HttpResponseMessage response = await SendAsync ( client , request ) ;
352
352
353
353
Measurement < double > m = Assert . Single ( recorder . GetMeasurements ( ) ) ;
@@ -455,6 +455,21 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
455
455
using InstrumentRecorder < double > recorder = SetupInstrumentRecorder < double > ( InstrumentNames . RequestDuration ) ;
456
456
using HttpRequestMessage request = new ( HttpMethod . Get , uri ) { Version = UseVersion } ;
457
457
using HttpResponseMessage response = await client . SendAsync ( TestAsync , request , completionOption ) ;
458
+ string responseContent = await response . Content . ReadAsStringAsync ( ) ;
459
+
460
+ if ( responseContentType == ResponseContentType . ContentLength )
461
+ {
462
+ Assert . NotNull ( response . Content . Headers . ContentLength ) ;
463
+ }
464
+ else if ( responseContentType == ResponseContentType . TransferEncodingChunked )
465
+ {
466
+ Assert . NotNull ( response . Headers . TransferEncodingChunked ) ;
467
+ }
468
+ else
469
+ {
470
+ // Empty
471
+ Assert . Empty ( responseContent ) ;
472
+ }
458
473
459
474
Measurement < double > m = Assert . Single ( recorder . GetMeasurements ( ) ) ;
460
475
VerifyRequestDuration ( m , uri , UseVersion , 200 ) ; ;
@@ -790,7 +805,7 @@ await Assert.ThrowsAsync<HttpRequestException>(async () =>
790
805
using HttpResponseMessage response = await SendAsync ( client , request ) ;
791
806
} ) ;
792
807
}
793
-
808
+
794
809
Measurement < double > m = Assert . Single ( recorder . GetMeasurements ( ) ) ;
795
810
VerifyRequestDuration ( m , uri , UseVersion , 200 ) ;
796
811
Assert . Equal ( "before!" , m . Tags . ToArray ( ) . Single ( t => t . Key == "before" ) . Value ) ;
0 commit comments