@@ -146,10 +146,16 @@ describe('middleware.proxy', () => {
146146 host : 'localhost' ,
147147 port : '8000' ,
148148 baseUrl : '/' ,
149- path : '/base/' ,
150- https : false
149+ path : '/base/'
151150 } )
152151 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
152+ expect ( parsedProxyConfig [ 0 ] . proxy ) . to . containSubset ( {
153+ options : {
154+ target : {
155+ protocol : 'http:'
156+ }
157+ }
158+ } )
153159 } )
154160
155161 it ( 'should set default http port' , ( ) => {
@@ -160,10 +166,16 @@ describe('middleware.proxy', () => {
160166 host : 'localhost' ,
161167 port : '80' ,
162168 baseUrl : '/' ,
163- path : '/base/' ,
164- https : false
169+ path : '/base/'
165170 } )
166171 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
172+ expect ( parsedProxyConfig [ 0 ] . proxy ) . to . containSubset ( {
173+ options : {
174+ target : {
175+ protocol : 'http:'
176+ }
177+ }
178+ } )
167179 } )
168180
169181 it ( 'should set default https port' , ( ) => {
@@ -174,8 +186,7 @@ describe('middleware.proxy', () => {
174186 host : 'localhost' ,
175187 port : '443' ,
176188 baseUrl : '/' ,
177- path : '/base/' ,
178- https : true
189+ path : '/base/'
179190 } )
180191 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
181192 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . containSubset ( {
@@ -195,10 +206,16 @@ describe('middleware.proxy', () => {
195206 host : 'localhost' ,
196207 port : '8000' ,
197208 baseUrl : '/proxy' ,
198- path : '/base' ,
199- https : false
209+ path : '/base'
200210 } )
201211 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
212+ expect ( parsedProxyConfig [ 0 ] . proxy ) . to . containSubset ( {
213+ options : {
214+ target : {
215+ protocol : 'http:'
216+ }
217+ }
218+ } )
202219 } )
203220
204221 it ( 'should determine protocol' , ( ) => {
@@ -209,8 +226,7 @@ describe('middleware.proxy', () => {
209226 host : 'localhost' ,
210227 port : '8000' ,
211228 baseUrl : '' ,
212- path : '/base' ,
213- https : true
229+ path : '/base'
214230 } )
215231 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
216232 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . containSubset ( {
@@ -231,8 +247,7 @@ describe('middleware.proxy', () => {
231247 host : 'localhost' ,
232248 port : 9877 ,
233249 baseUrl : '/proxy/test' ,
234- path : '/base' ,
235- https : false
250+ path : '/base'
236251 } )
237252 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
238253 } )
@@ -246,8 +261,7 @@ describe('middleware.proxy', () => {
246261 host : 'localhost' ,
247262 port : 9877 ,
248263 baseUrl : '/proxy/test/' ,
249- path : '/base/' ,
250- https : false
264+ path : '/base/'
251265 } )
252266 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
253267 } )
@@ -261,8 +275,7 @@ describe('middleware.proxy', () => {
261275 host : 'krinkle.dev' ,
262276 port : '80' ,
263277 baseUrl : '/w' ,
264- path : '/w' ,
265- https : false
278+ path : '/w'
266279 } )
267280 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
268281 } )
@@ -276,8 +289,7 @@ describe('middleware.proxy', () => {
276289 host : 'krinkle.dev' ,
277290 port : '443' ,
278291 baseUrl : '/w' ,
279- path : '/w' ,
280- https : true
292+ path : '/w'
281293 } )
282294 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
283295 } )
@@ -290,8 +302,7 @@ describe('middleware.proxy', () => {
290302 host : 'localhost' ,
291303 port : '8000' ,
292304 baseUrl : '/proxy/test/' ,
293- path : '/base/' ,
294- https : false
305+ path : '/base/'
295306 } )
296307 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
297308 } )
@@ -307,16 +318,14 @@ describe('middleware.proxy', () => {
307318 host : 'gstatic.com' ,
308319 port : '80' ,
309320 baseUrl : '/something' ,
310- path : '/sub/some' ,
311- https : false
321+ path : '/sub/some'
312322 } )
313323 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
314324 expect ( parsedProxyConfig [ 1 ] ) . to . containSubset ( {
315325 host : 'localhost' ,
316326 port : '9000' ,
317327 baseUrl : '' ,
318- path : '/sub' ,
319- https : false
328+ path : '/sub'
320329 } )
321330 expect ( parsedProxyConfig [ 1 ] . proxy ) . to . exist
322331 } )
@@ -331,8 +340,7 @@ describe('middleware.proxy', () => {
331340 host : 'localhost' ,
332341 port : '8000' ,
333342 baseUrl : '/' ,
334- path : '/base/' ,
335- https : false
343+ path : '/base/'
336344 } )
337345 expect ( parsedProxyConfig [ 0 ] . proxy ) . to . exist
338346 } )
@@ -352,24 +360,4 @@ describe('middleware.proxy', () => {
352360 it ( 'should handle empty proxy config' , ( ) => {
353361 expect ( m . parseProxyConfig ( { } ) ) . to . deep . equal ( [ ] )
354362 } )
355-
356- it ( 'should use http agent with keepAlive=true' , ( ) => {
357- const proxy = { '/base' : 'http://localhost:8000/proxy' }
358- const parsedProxyConfig = m . parseProxyConfig ( proxy , { } )
359- expect ( parsedProxyConfig ) . to . have . length ( 1 )
360- expect ( parsedProxyConfig [ 0 ] . proxy . options . agent ) . to . containSubset ( {
361- keepAlive : true ,
362- protocol : 'http:'
363- } )
364- } )
365-
366- it ( 'should use https agent with keepAlive=true' , ( ) => {
367- const proxy = { '/base' : 'https://localhost:8000/proxy' }
368- const parsedProxyConfig = m . parseProxyConfig ( proxy , { } )
369- expect ( parsedProxyConfig ) . to . have . length ( 1 )
370- expect ( parsedProxyConfig [ 0 ] . proxy . options . agent ) . to . containSubset ( {
371- keepAlive : true ,
372- protocol : 'https:'
373- } )
374- } )
375363} )
0 commit comments