@@ -34,13 +34,13 @@ describe('E2E router', () => {
3434
3535 await targetServerA
3636 . forAnyRequest ( )
37- . thenCallback ( ( { protocol } ) => ( { body : protocol === 'https' ? 'A' : 'NOT HTTPS A' } ) ) ;
37+ . thenCallback ( ( { protocol } ) => ( { body : protocol === 'https' ? 'HTTPS A' : 'HTTP A' } ) ) ;
3838 await targetServerB
3939 . forAnyRequest ( )
40- . thenCallback ( ( { protocol } ) => ( { body : protocol === 'https' ? 'B' : 'NOT HTTPS B' } ) ) ;
40+ . thenCallback ( ( { protocol } ) => ( { body : protocol === 'https' ? 'HTTPS B' : 'HTTP B' } ) ) ;
4141 await targetServerC
4242 . forAnyRequest ( )
43- . thenCallback ( ( { protocol } ) => ( { body : protocol === 'https' ? 'C' : 'NOT HTTPS C' } ) ) ;
43+ . thenCallback ( ( { protocol } ) => ( { body : protocol === 'https' ? 'HTTPS C' : 'HTTP C' } ) ) ;
4444
4545 await targetServerA . start ( targetPortA ) ;
4646 await targetServerB . start ( targetPortB ) ;
@@ -68,7 +68,7 @@ describe('E2E router', () => {
6868
6969 const agent = request ( app ) ;
7070 const response = await agent . get ( '/api' ) . expect ( 200 ) ;
71- expect ( response . text ) . toBe ( 'C' ) ;
71+ expect ( response . text ) . toBe ( 'HTTPS C' ) ;
7272 } ) ;
7373
7474 it ( 'should work with an object' , async ( ) => {
@@ -84,7 +84,7 @@ describe('E2E router', () => {
8484 ) ;
8585 const agent = request ( app ) ;
8686 const response = await agent . get ( '/api' ) . expect ( 200 ) ;
87- expect ( response . text ) . toBe ( 'C' ) ;
87+ expect ( response . text ) . toBe ( 'HTTPS C' ) ;
8888 } ) ;
8989
9090 it ( 'should work with an async callback' , async ( ) => {
@@ -103,7 +103,7 @@ describe('E2E router', () => {
103103
104104 const agent = request ( app ) ;
105105 const response = await agent . get ( '/api' ) . expect ( 200 ) ;
106- expect ( response . text ) . toBe ( 'C' ) ;
106+ expect ( response . text ) . toBe ( 'HTTPS C' ) ;
107107 } ) ;
108108
109109 it ( 'should handle promise rejection in router' , async ( ) => {
@@ -127,7 +127,7 @@ describe('E2E router', () => {
127127 expect ( response . text ) . toBe ( 'An error thrown in the router' ) ;
128128 } ) ;
129129
130- it ( 'missing a : will cause it to use http ' , async ( ) => {
130+ it ( 'missing a ":" in protocol will cause it to use https ' , async ( ) => {
131131 const app = createApp (
132132 createProxyMiddleware ( {
133133 target : `https://localhost:${ targetPortA } ` ,
@@ -143,7 +143,7 @@ describe('E2E router', () => {
143143
144144 const agent = request ( app ) ;
145145 const response = await agent . get ( '/api' ) . expect ( 200 ) ;
146- expect ( response . text ) . toBe ( 'NOT HTTPS C' ) ;
146+ expect ( response . text ) . toBe ( 'HTTPS C' ) ;
147147 } ) ;
148148 } ) ;
149149
@@ -171,25 +171,25 @@ describe('E2E router', () => {
171171 it ( 'should proxy to option.target' , async ( ) => {
172172 const response = await agent . get ( '/api' ) . expect ( 200 ) ;
173173
174- expect ( response . text ) . toBe ( 'A' ) ;
174+ expect ( response . text ) . toBe ( 'HTTPS A' ) ;
175175 } ) ;
176176
177177 it ( 'should proxy when host is "alpha.localhost"' , async ( ) => {
178178 const response = await agent . get ( '/api' ) . set ( 'host' , 'alpha.localhost:6000' ) . expect ( 200 ) ;
179179
180- expect ( response . text ) . toBe ( 'A' ) ;
180+ expect ( response . text ) . toBe ( 'HTTPS A' ) ;
181181 } ) ;
182182
183183 it ( 'should proxy when host is "beta.localhost"' , async ( ) => {
184184 const response = await agent . get ( '/api' ) . set ( 'host' , 'beta.localhost:6000' ) . expect ( 200 ) ;
185185
186- expect ( response . text ) . toBe ( 'B' ) ;
186+ expect ( response . text ) . toBe ( 'HTTPS B' ) ;
187187 } ) ;
188188
189189 it ( 'should proxy with host & path config: "localhost:6000/api"' , async ( ) => {
190190 const response = await agent . get ( '/api' ) . set ( 'host' , 'localhost:6000' ) . expect ( 200 ) ;
191191
192- expect ( response . text ) . toBe ( 'C' ) ;
192+ expect ( response . text ) . toBe ( 'HTTPS C' ) ;
193193 } ) ;
194194 } ) ;
195195} ) ;
0 commit comments