diff --git a/index.js b/index.js index d18114e..b63119c 100644 --- a/index.js +++ b/index.js @@ -202,6 +202,10 @@ function normalizeArguments(url, opts) { opts ); + if (!Number.isInteger(opts.port)) { + opts.port = opts.protocol === 'http' ? 80 : 443; + } + opts.headers = Object.assign({ 'user-agent': 'https://github.com/sindresorhus/got', 'accept-encoding': 'gzip,deflate'