@@ -196,17 +196,16 @@ public async Task ClientCertificate_AllowOrRequire_Available_Invalid_Refused(Cli
196
196
197
197
if ( ! serverAllowInvalid )
198
198
{
199
- // In .NET 6 there is a race condition between throwing HttpRequestException and QuicException.
200
- // Unable to test the exact error.
201
- var ex = await Assert . ThrowsAnyAsync < Exception > ( ( ) => sendTask ) . DefaultTimeout ( ) ;
199
+ var ex = await Assert . ThrowsAnyAsync < HttpRequestException > ( ( ) => sendTask ) . DefaultTimeout ( ) ;
202
200
Logger . LogInformation ( ex , "SendAsync successfully threw error." ) ;
203
201
}
204
202
else
205
203
{
206
- // Because we can't verify the exact error reason, check that the cert is the cause be successfully
204
+ // Because we can't verify the exact error reason, check that the cert is the cause by successfully
207
205
// making a call when invalid certs are allowed.
208
- var response = await sendTask . DefaultTimeout ( ) ;
206
+ using var response = await sendTask . DefaultTimeout ( ) ;
209
207
response . EnsureSuccessStatusCode ( ) ;
208
+ Assert . Equal ( "True" , await response . Content . ReadAsStringAsync ( ) . DefaultTimeout ( ) ) ;
210
209
}
211
210
212
211
await host . StopAsync ( ) . DefaultTimeout ( ) ;
@@ -215,7 +214,6 @@ public async Task ClientCertificate_AllowOrRequire_Available_Invalid_Refused(Cli
215
214
[ ConditionalFact ]
216
215
[ MsQuicSupported ]
217
216
[ OSSkipCondition ( OperatingSystems . MacOSX | OperatingSystems . Linux , SkipReason = "https://github.com/dotnet/aspnetcore/issues/35800" ) ]
218
- [ QuarantinedTest ( "https://github.com/dotnet/aspnetcore/issues/41894" ) ]
219
217
public async Task ClientCertificate_Allow_NotAvailable_Optional ( )
220
218
{
221
219
var builder = CreateHostBuilder ( async context =>
@@ -245,9 +243,9 @@ public async Task ClientCertificate_Allow_NotAvailable_Optional()
245
243
request . Version = HttpVersion . Version30 ;
246
244
request . VersionPolicy = HttpVersionPolicy . RequestVersionExact ;
247
245
248
- // https://github.com/dotnet/runtime/issues/57308, optional client certs aren't supported.
249
- var ex = await Assert . ThrowsAsync < HttpRequestException > ( ( ) => client . SendAsync ( request , CancellationToken . None ) . DefaultTimeout ( ) ) ;
250
- Assert . StartsWith ( "Connection has been shutdown by transport: ", ex . Message ) ;
246
+ var response = await client . SendAsync ( request , CancellationToken . None ) . DefaultTimeout ( ) ;
247
+ Assert . True ( response . IsSuccessStatusCode ) ;
248
+ Assert . Equal ( "False ", await response . Content . ReadAsStringAsync ( ) ) ;
251
249
252
250
await host . StopAsync ( ) . DefaultTimeout ( ) ;
253
251
}
0 commit comments