@@ -14,10 +14,14 @@ const { Client, Agent, FormData, Response } = require('..')
1414test ( 'Should support H2 connection' , async t => {
1515 const body = [ ]
1616 const server = createSecureServer ( await pem . generate ( { opts : { keySize : 2048 } } ) )
17+ let authority = ''
1718
1819 server . on ( 'stream' , ( stream , headers , _flags , rawHeaders ) => {
1920 t . strictEqual ( headers [ 'x-my-header' ] , 'foo' )
2021 t . strictEqual ( headers [ ':method' ] , 'GET' )
22+ t . strictEqual ( headers [ ':scheme' ] , 'https' )
23+ t . strictEqual ( headers [ ':path' ] , '/' )
24+ t . strictEqual ( headers [ ':authority' ] , authority )
2125 stream . respond ( {
2226 'content-type' : 'text/plain; charset=utf-8' ,
2327 'x-custom-h2' : 'hello' ,
@@ -28,15 +32,15 @@ test('Should support H2 connection', async t => {
2832
2933 server . listen ( 0 )
3034 await once ( server , 'listening' )
31-
32- const client = new Client ( `https://localhost: ${ server . address ( ) . port } ` , {
35+ authority = `localhost: ${ server . address ( ) . port } `
36+ const client = new Client ( `https://${ authority } ` , {
3337 connect : {
3438 rejectUnauthorized : false
3539 } ,
3640 allowH2 : true
3741 } )
3842
39- t = tspl ( t , { plan : 6 } )
43+ t = tspl ( t , { plan : 9 } )
4044 after ( ( ) => server . close ( ) )
4145 after ( ( ) => client . close ( ) )
4246
0 commit comments