diff --git a/package.json b/package.json index efa9dd5..8b3fade 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http2-wrapper", - "version": "2.1.6", + "version": "2.1.7", "description": "HTTP2 client, just with the familiar `https` API", "main": "source", "types": "index.d.ts", diff --git a/source/client-request.js b/source/client-request.js index 512ab22..b5cd925 100644 --- a/source/client-request.js +++ b/source/client-request.js @@ -503,7 +503,7 @@ class ClientRequest extends Writable { const lowercased = name.toLowerCase(); if (lowercased === 'connection') { - if (value === 'keep-alive') { + if (value.toLowerCase() === 'keep-alive') { return; } diff --git a/test/request.js b/test/request.js index 8116196..32fb533 100644 --- a/test/request.js +++ b/test/request.js @@ -1047,6 +1047,21 @@ test('does not throw on connection: keep-alive header', wrapper, async (t, serve t.false('connection' in headers); }); +test('does not throw on connection: keep-alive header (uppercase)', wrapper, async (t, server) => { + const request = makeRequest(server.url, { + headers: { + connection: 'KEEP-ALIVE' + } + }); + request.end(); + + const response = await pEvent(request, 'response'); + const body = await getStream(response); + const {headers} = JSON.parse(body); + + t.false('connection' in headers); +}); + test('throws on connection: close header', wrapper, async (t, server) => { t.throws(() => makeRequest(server.url, { headers: {