@@ -11,8 +11,6 @@ const pem = require('@metcoder95/https-pem')
1111
1212const { Client, Agent, FormData } = require ( '..' )
1313
14- const isGreaterThanv20 = process . versions . node . split ( '.' ) . map ( Number ) [ 0 ] >= 20
15-
1614test ( 'Should support H2 connection' , async t => {
1715 const body = [ ]
1816 const server = createSecureServer ( await pem . generate ( { opts : { keySize : 2048 } } ) )
@@ -356,49 +354,6 @@ test('Should throw if bad maxConcurrentStreams has been passed', async t => {
356354
357355test (
358356 'Request should fail if allowH2 is false and server advertises h1 only' ,
359- { skip : isGreaterThanv20 } ,
360- async t => {
361- t = tspl ( t , { plan : 1 } )
362-
363- const server = createSecureServer (
364- {
365- ...await pem . generate ( { opts : { keySize : 2048 } } ) ,
366- allowHTTP1 : false ,
367- ALPNProtocols : [ 'http/1.1' ]
368- } ,
369- ( req , res ) => {
370- t . fail ( 'Should not create a valid h2 stream' )
371- }
372- )
373-
374- server . listen ( 0 )
375- await once ( server , 'listening' )
376-
377- const client = new Client ( `https://localhost:${ server . address ( ) . port } ` , {
378- allowH2 : false ,
379- connect : {
380- rejectUnauthorized : false
381- }
382- } )
383-
384- after ( ( ) => server . close ( ) )
385- after ( ( ) => client . close ( ) )
386-
387- const response = await client . request ( {
388- path : '/' ,
389- method : 'GET' ,
390- headers : {
391- 'x-my-header' : 'foo'
392- }
393- } )
394-
395- t . strictEqual ( response . statusCode , 403 )
396- }
397- )
398-
399- test (
400- '[v20] Request should fail if allowH2 is false and server advertises h1 only' ,
401- { skip : ! isGreaterThanv20 } ,
402357 async t => {
403358 const server = createSecureServer (
404359 {
@@ -1029,7 +984,7 @@ test('Should handle h2 request with body (iterable)', async t => {
1029984 t . strictEqual ( Buffer . concat ( requestChunks ) . toString ( 'utf-8' ) , expectedBody )
1030985} )
1031986
1032- test ( 'Should handle h2 request with body (Blob)' , { skip : ! Blob } , async t => {
987+ test ( 'Should handle h2 request with body (Blob)' , async t => {
1033988 const server = createSecureServer ( await pem . generate ( { opts : { keySize : 2048 } } ) )
1034989 const expectedBody = 'asd'
1035990 const requestChunks = [ ]
0 commit comments