@@ -117,7 +117,7 @@ describe("When configured for HTTPS", () => {
117
117
keyPath : './test/fixtures/test-ca.key' ,
118
118
certPath : './test/fixtures/test-ca.pem' ,
119
119
tlsPassthrough : [
120
- { hostname : 'example.com ' } ,
120
+ { hostname : 'example.testserver.host ' } ,
121
121
// A convenient server that doesn't require SNI to serve the right cert:
122
122
{ hostname : 'ip-api.com' }
123
123
]
@@ -144,14 +144,12 @@ describe("When configured for HTTPS", () => {
144
144
} ) ;
145
145
146
146
it ( "skips the server for matching HTTPS requests" , async function ( ) {
147
- this . retries ( 3 ) ; // Example.com can be unreliable
148
-
149
147
const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
150
148
https . get ( {
151
149
host : 'localhost' ,
152
150
port : server . port ,
153
- servername : 'example.com ' ,
154
- headers : { 'Host' : 'example.com ' }
151
+ servername : 'example.testserver.host ' ,
152
+ headers : { 'Host' : 'example.testserver.host ' }
155
153
} ) . on ( 'response' , resolve ) . on ( 'error' , reject )
156
154
) ;
157
155
@@ -166,7 +164,7 @@ describe("When configured for HTTPS", () => {
166
164
const response : http . IncomingMessage = await new Promise ( ( resolve ) =>
167
165
http . get ( {
168
166
port : server . port ,
169
- headers : { 'Host' : 'example.com ' }
167
+ headers : { 'Host' : 'example.testserver.host ' }
170
168
} ) . on ( 'response' , resolve )
171
169
) ;
172
170
@@ -196,12 +194,12 @@ describe("When configured for HTTPS", () => {
196
194
197
195
it ( "bypasses Mockttp for TLS connections with matching SNI" , async ( ) => {
198
196
const tlsSocket = await openRawTlsSocket ( server , {
199
- servername : 'example.com '
197
+ servername : 'example.testserver.host '
200
198
} ) ;
201
199
202
200
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
205
203
} ) ;
206
204
207
205
it ( "bypasses Mockttp for TLS connections inside matching HTTP/1 CONNECT tunnel" , async ( ) => {
@@ -227,7 +225,7 @@ describe("When configured for HTTPS", () => {
227
225
it ( "still handles matching CONNECT-tunnelled plain-HTTP requests" , async ( ) => {
228
226
const tunnel = await openRawSocket ( server ) ;
229
227
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' ) ;
231
229
232
230
await delay ( 50 ) ;
233
231
const result = tunnel . read ( ) ;
@@ -236,7 +234,7 @@ describe("When configured for HTTPS", () => {
236
234
const response : http . IncomingMessage = await new Promise ( ( resolve ) =>
237
235
http . get ( {
238
236
createConnection : ( ) => tunnel ,
239
- headers : { 'Host' : 'example.com ' }
237
+ headers : { 'Host' : 'example.testserver.host ' }
240
238
} ) . on ( 'response' , resolve )
241
239
) ;
242
240
@@ -246,9 +244,7 @@ describe("When configured for HTTPS", () => {
246
244
} ) ;
247
245
248
246
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' ) ;
252
248
253
249
expect ( response . body . toString ( ) ) . to . include (
254
250
"This domain is for use in illustrative examples in documents."
@@ -262,7 +258,7 @@ describe("When configured for HTTPS", () => {
262
258
keyPath : './test/fixtures/test-ca.key' ,
263
259
certPath : './test/fixtures/test-ca.pem' ,
264
260
tlsPassthrough : [
265
- { hostname : '*.com ' }
261
+ { hostname : '*.testserver.host ' }
266
262
]
267
263
}
268
264
} ) ;
@@ -292,14 +288,12 @@ describe("When configured for HTTPS", () => {
292
288
} ) ;
293
289
294
290
it ( "skips the server for non-matching HTTPS requests" , async function ( ) {
295
- this . retries ( 3 ) ; // Example.com can be unreliable
296
-
297
291
const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
298
292
https . get ( {
299
293
host : 'localhost' ,
300
294
port : server . port ,
301
- servername : 'example.com ' ,
302
- headers : { 'Host' : 'example.com ' }
295
+ servername : 'example.testserver.host ' ,
296
+ headers : { 'Host' : 'example.testserver.host ' }
303
297
} ) . on ( 'response' , resolve ) . on ( 'error' , reject )
304
298
) ;
305
299
@@ -347,14 +341,12 @@ describe("When configured for HTTPS", () => {
347
341
} ) ;
348
342
349
343
it ( "skips the server for non-matching HTTPS requests" , async function ( ) {
350
- this . retries ( 3 ) ; // Example.com can be unreliable
351
-
352
344
const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
353
345
https . get ( {
354
346
host : 'localhost' ,
355
347
port : server . port ,
356
- servername : 'example.com ' ,
357
- headers : { 'Host' : 'example.com ' }
348
+ servername : 'example.testserver.host ' ,
349
+ headers : { 'Host' : 'example.testserver.host ' }
358
350
} ) . on ( 'response' , resolve ) . on ( 'error' , reject )
359
351
) ;
360
352
@@ -402,14 +394,12 @@ describe("When configured for HTTPS", () => {
402
394
} ) ;
403
395
404
396
it ( "skips the server for non-matching HTTPS requests" , async function ( ) {
405
- this . retries ( 3 ) ; // Example.com can be unreliable
406
-
407
397
const response : http . IncomingMessage = await new Promise ( ( resolve , reject ) =>
408
398
https . get ( {
409
399
host : 'localhost' ,
410
400
port : server . port ,
411
- servername : 'example.com ' ,
412
- headers : { 'Host' : 'example.com ' }
401
+ servername : 'example.testserver.host ' ,
402
+ headers : { 'Host' : 'example.testserver.host ' }
413
403
} ) . on ( 'response' , resolve ) . on ( 'error' , reject )
414
404
) ;
415
405
0 commit comments