diff --git a/package.json b/package.json index 3671548..efa9dd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http2-wrapper", - "version": "2.1.5", + "version": "2.1.6", "description": "HTTP2 client, just with the familiar `https` API", "main": "source", "types": "index.d.ts", diff --git a/source/auto.js b/source/auto.js index d1d90e4..6085d0d 100644 --- a/source/auto.js +++ b/source/auto.js @@ -124,7 +124,7 @@ module.exports = async (input, options, callback) => { options.host = options.hostname || options.host || 'localhost'; options.session = options.tlsSession; - options.servername = options.servername || calculateServerName(options.headers?.host || options.host); + options.servername = options.servername || calculateServerName((options.headers && options.headers.host) || options.host); options.port = options.port || (isHttps ? 443 : 80); options._defaultAgent = isHttps ? https.globalAgent : http.globalAgent;