diff --git a/test/http2-alpn.js b/test/http2-alpn.js index 3fd89e923a0..840d77a83c1 100644 --- a/test/http2-alpn.js +++ b/test/http2-alpn.js @@ -91,6 +91,7 @@ test('Should upgrade to HTTP/2 when HTTPS/1 is available for GET', async (t) => const httpsOptions = { ca, servername: 'agent1', + ALPNProtocols: ['http/1.1'], headers: { 'x-custom-request-header': 'want 1.1' } @@ -117,7 +118,7 @@ test('Should upgrade to HTTP/2 when HTTPS/1 is available for GET', async (t) => t.equal(httpsResponse.headers['x-custom-request-header'], 'want 1.1') t.equal(httpsResponse.headers['x-custom-response-header'], 'using 1.1') t.equal(Buffer.concat(httpsBody).toString('utf8'), JSON.stringify({ - alpnProtocol: false, + alpnProtocol: 'http/1.1', httpVersion: '1.1' })) @@ -237,6 +238,7 @@ test('Should upgrade to HTTP/2 when HTTPS/1 is available for POST', async (t) => const httpsOptions = { ca, servername: 'agent1', + ALPNProtocols: ['http/1.1'], method: 'POST', headers: { 'content-type': 'text/plain; charset=utf-8', @@ -262,7 +264,7 @@ test('Should upgrade to HTTP/2 when HTTPS/1 is available for POST', async (t) => reject(err) }) - httpsRequest.write(Buffer.from(body)) + httpsRequest.end(Buffer.from(body)) after(() => httpsRequest.destroy()) }) @@ -270,7 +272,7 @@ test('Should upgrade to HTTP/2 when HTTPS/1 is available for POST', async (t) => t.equal(httpsResponse.statusCode, 201) t.equal(httpsResponse.headers['content-type'], 'text/plain; charset=utf-8') t.equal(httpsResponse.headers['x-custom-request-header'], 'want 1.1') - t.equal(httpsResponse.headers['x-custom-alpn-protocol'], 'false') + t.equal(httpsResponse.headers['x-custom-alpn-protocol'], 'http/1.1') t.equal(Buffer.concat(httpsResponseBody).toString('utf-8'), 'hello http/1!') t.equal(Buffer.concat(httpsRequestChunks).toString('utf-8'), expectedBody)