diff --git a/lib/connect/index.js b/lib/connect/index.js index e865d54fa..a0a0f159f 100644 --- a/lib/connect/index.js +++ b/lib/connect/index.js @@ -62,15 +62,22 @@ function connect (brokerUrl, opts) { throw new Error('Missing protocol') } var parsed = new URL(brokerUrl) + // the URL object is a bit special, so copy individual // items to the opts object - opts.hostname = parsed.hostname + opts.hash = parsed.hash opts.host = parsed.host - opts.protocol = parsed.protocol + opts.hostname = parsed.hostname + opts.href = parsed.href + opts.origin = parsed.origin + opts.pathname = parsed.pathname opts.port = Number(parsed.port) || null + opts.protocol = parsed.protocol opts.username = opts.username || parsed.username opts.password = opts.password || parsed.password + opts.search = parsed.search opts.searchParams = parsed.searchParams + opts.path = parsed.pathname + parsed.search opts.protocol = opts.protocol.replace(/:$/, '') }