@@ -44,11 +44,7 @@ public async Task HttpsHelloWorld(TestVariant variant)
44
44
45
45
var deploymentResult = await DeployAsync ( deploymentParameters ) ;
46
46
47
- var handler = new HttpClientHandler
48
- {
49
- ServerCertificateCustomValidationCallback = ( a , b , c , d ) => true
50
- } ;
51
- var client = deploymentResult . CreateClient ( handler ) ;
47
+ var client = CreateNonValidatingClient ( deploymentResult ) ;
52
48
var response = await client . GetAsync ( "HttpsHelloWorld" ) ;
53
49
var responseText = await response . Content . ReadAsStringAsync ( ) ;
54
50
if ( variant . HostingModel == HostingModel . OutOfProcess )
@@ -94,7 +90,9 @@ public async Task ServerAddressesIncludesBaseAddress()
94
90
} ) ;
95
91
96
92
var deploymentResult = await DeployAsync ( deploymentParameters ) ;
97
- Assert . Equal ( deploymentParameters . ApplicationBaseUriHint + appName , await deploymentResult . HttpClient . GetStringAsync ( $ "/{ appName } /ServerAddresses") ) ;
93
+ var client = CreateNonValidatingClient ( deploymentResult ) ;
94
+
95
+ Assert . Equal ( deploymentParameters . ApplicationBaseUriHint + appName , await client . GetStringAsync ( $ "/{ appName } /ServerAddresses") ) ;
98
96
}
99
97
100
98
[ ConditionalFact ]
@@ -115,7 +113,9 @@ public async Task HttpsPortCanBeOverriden()
115
113
deploymentParameters . WebConfigBasedEnvironmentVariables [ "ASPNETCORE_HTTPS_PORT" ] = "123" ;
116
114
117
115
var deploymentResult = await DeployAsync ( deploymentParameters ) ;
118
- Assert . Equal ( "123" , await deploymentResult . HttpClient . GetStringAsync ( "/HTTPS_PORT" ) ) ;
116
+ var client = CreateNonValidatingClient ( deploymentResult ) ;
117
+
118
+ Assert . Equal ( "123" , await client . GetStringAsync ( "/HTTPS_PORT" ) ) ;
119
119
}
120
120
121
121
[ ConditionalFact ]
@@ -142,7 +142,18 @@ public async Task MultipleHttpsPortsProduceNoEnvVar()
142
142
} ) ;
143
143
144
144
var deploymentResult = await DeployAsync ( deploymentParameters ) ;
145
- Assert . Equal ( "NOVALUE" , await deploymentResult . HttpClient . GetStringAsync ( "/HTTPS_PORT" ) ) ;
145
+ var client = CreateNonValidatingClient ( deploymentResult ) ;
146
+
147
+ Assert . Equal ( "NOVALUE" , await client . GetStringAsync ( "/HTTPS_PORT" ) ) ;
148
+ }
149
+
150
+ private static HttpClient CreateNonValidatingClient ( IISDeploymentResult deploymentResult )
151
+ {
152
+ var handler = new HttpClientHandler
153
+ {
154
+ ServerCertificateCustomValidationCallback = ( a , b , c , d ) => true
155
+ } ;
156
+ return deploymentResult . CreateClient ( handler ) ;
146
157
}
147
158
148
159
public static int GetNextSSLPort ( int avoid = 0 )
0 commit comments