@@ -117,7 +117,7 @@ describe("When configured for HTTPS", () => {
117117 keyPath : './test/fixtures/test-ca.key' ,
118118 certPath : './test/fixtures/test-ca.pem' ,
119119 tlsPassthrough : [
120- { hostname : 'example.com ' } ,
120+ { hostname : 'example.testserver.host ' } ,
121121 // A convenient server that doesn't require SNI to serve the right cert:
122122 { hostname : 'ip-api.com' }
123123 ]
@@ -144,14 +144,12 @@ describe("When configured for HTTPS", () => {
144144 } ) ;
145145
146146 it ( "skips the server for matching HTTPS requests" , async function ( ) {
147- this . retries ( 3 ) ; // Example.com can be unreliable
148-
149147 const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
150148 https . get ( {
151149 host : 'localhost' ,
152150 port : server . port ,
153- servername : 'example.com ' ,
154- headers : { 'Host' : 'example.com ' }
151+ servername : 'example.testserver.host ' ,
152+ headers : { 'Host' : 'example.testserver.host ' }
155153 } ) . on ( 'response' , resolve ) . on ( 'error' , reject )
156154 ) ;
157155
@@ -166,7 +164,7 @@ describe("When configured for HTTPS", () => {
166164 const response : http . IncomingMessage = await new Promise ( ( resolve ) =>
167165 http . get ( {
168166 port : server . port ,
169- headers : { 'Host' : 'example.com ' }
167+ headers : { 'Host' : 'example.testserver.host ' }
170168 } ) . on ( 'response' , resolve )
171169 ) ;
172170
@@ -196,12 +194,12 @@ describe("When configured for HTTPS", () => {
196194
197195 it ( "bypasses Mockttp for TLS connections with matching SNI" , async ( ) => {
198196 const tlsSocket = await openRawTlsSocket ( server , {
199- servername : 'example.com '
197+ servername : 'example.testserver.host '
200198 } ) ;
201199
202200 const cert = tlsSocket . getPeerCertificate ( ) ;
203- expect ( cert . subject . CN ) . to . equal ( '*. example.com ' ) ;
204- expect ( cert . issuer . CN ) . to . include ( 'DigiCert ' ) ; // <-- This is the real issuer, right now at least
201+ expect ( cert . subject . CN ) . to . equal ( 'example.testserver.host ' ) ;
202+ expect ( cert . issuer . CN ) . to . include ( 'ZeroSSL RSA Domain Secure Site CA ' ) ; // <-- This is the real issuer, right now at least
205203 } ) ;
206204
207205 it ( "bypasses Mockttp for TLS connections inside matching HTTP/1 CONNECT tunnel" , async ( ) => {
@@ -227,7 +225,7 @@ describe("When configured for HTTPS", () => {
227225 it ( "still handles matching CONNECT-tunnelled plain-HTTP requests" , async ( ) => {
228226 const tunnel = await openRawSocket ( server ) ;
229227
230- tunnel . write ( 'CONNECT example.com :80 HTTP/1.1\r\n\r\n' ) ;
228+ tunnel . write ( 'CONNECT example.testserver.host :80 HTTP/1.1\r\n\r\n' ) ;
231229
232230 await delay ( 50 ) ;
233231 const result = tunnel . read ( ) ;
@@ -236,7 +234,7 @@ describe("When configured for HTTPS", () => {
236234 const response : http . IncomingMessage = await new Promise ( ( resolve ) =>
237235 http . get ( {
238236 createConnection : ( ) => tunnel ,
239- headers : { 'Host' : 'example.com ' }
237+ headers : { 'Host' : 'example.testserver.host ' }
240238 } ) . on ( 'response' , resolve )
241239 ) ;
242240
@@ -246,9 +244,7 @@ describe("When configured for HTTPS", () => {
246244 } ) ;
247245
248246 it ( "bypasses Mockttp for TLS connections inside matching HTTP/2 CONNECT tunnel" , async function ( ) {
249- this . retries ( 3 ) ; // Example.com can be unreliable
250-
251- const response = await http2ProxyRequest ( server , 'https://example.com' ) ;
247+ const response = await http2ProxyRequest ( server , 'https://example.testserver.host' ) ;
252248
253249 expect ( response . body . toString ( ) ) . to . include (
254250 "This domain is for use in illustrative examples in documents."
@@ -262,7 +258,7 @@ describe("When configured for HTTPS", () => {
262258 keyPath : './test/fixtures/test-ca.key' ,
263259 certPath : './test/fixtures/test-ca.pem' ,
264260 tlsPassthrough : [
265- { hostname : '*.com ' }
261+ { hostname : '*.testserver.host ' }
266262 ]
267263 }
268264 } ) ;
@@ -292,14 +288,12 @@ describe("When configured for HTTPS", () => {
292288 } ) ;
293289
294290 it ( "skips the server for non-matching HTTPS requests" , async function ( ) {
295- this . retries ( 3 ) ; // Example.com can be unreliable
296-
297291 const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
298292 https . get ( {
299293 host : 'localhost' ,
300294 port : server . port ,
301- servername : 'example.com ' ,
302- headers : { 'Host' : 'example.com ' }
295+ servername : 'example.testserver.host ' ,
296+ headers : { 'Host' : 'example.testserver.host ' }
303297 } ) . on ( 'response' , resolve ) . on ( 'error' , reject )
304298 ) ;
305299
@@ -347,14 +341,12 @@ describe("When configured for HTTPS", () => {
347341 } ) ;
348342
349343 it ( "skips the server for non-matching HTTPS requests" , async function ( ) {
350- this . retries ( 3 ) ; // Example.com can be unreliable
351-
352344 const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
353345 https . get ( {
354346 host : 'localhost' ,
355347 port : server . port ,
356- servername : 'example.com ' ,
357- headers : { 'Host' : 'example.com ' }
348+ servername : 'example.testserver.host ' ,
349+ headers : { 'Host' : 'example.testserver.host ' }
358350 } ) . on ( 'response' , resolve ) . on ( 'error' , reject )
359351 ) ;
360352
@@ -402,14 +394,12 @@ describe("When configured for HTTPS", () => {
402394 } ) ;
403395
404396 it ( "skips the server for non-matching HTTPS requests" , async function ( ) {
405- this . retries ( 3 ) ; // Example.com can be unreliable
406-
407397 const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
408398 https . get ( {
409399 host : 'localhost' ,
410400 port : server . port ,
411- servername : 'example.com ' ,
412- headers : { 'Host' : 'example.com ' }
401+ servername : 'example.testserver.host ' ,
402+ headers : { 'Host' : 'example.testserver.host ' }
413403 } ) . on ( 'response' , resolve ) . on ( 'error' , reject )
414404 ) ;
415405
0 commit comments