diff --git a/index.js b/index.js index 483d7d9..f83b05c 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,9 @@ function fastifyAmqp (fastify, opts, next) { const port = opts.port || 5672 const user = opts.user || 'guest' const pass = opts.pass || 'guest' + const vhost = opts.vhost || '' - amqpClient.connect(`amqp://${user}:${pass}@${host}:${port}/`, function (err, connection) { + amqpClient.connect(`amqp://${user}:${pass}@${host}:${port}/${encodeURIComponent(vhost)}`, function (err, connection) { if (err) { next(err) return