diff --git a/api/cluster/health.js b/api/cluster/health.js index 9924767e5..e21260fec 100644 --- a/api/cluster/health.js +++ b/api/cluster/health.js @@ -51,7 +51,7 @@ function healthFunc(params, options, callback) { let { body, index, ...querystring } = params; index = parsePathParam(index); - const path = ['/_cluster/health/', index].filter(c => c).join('').replace('//', '/'); + const path = ['/_cluster/health', index].filter(c => c).join('/'); const method = 'GET'; body = body || ''; diff --git a/test/acceptance/proxy.test.js b/test/acceptance/proxy.test.js index f9461b294..dc2cf1b06 100644 --- a/test/acceptance/proxy.test.js +++ b/test/acceptance/proxy.test.js @@ -23,7 +23,7 @@ test('http-http proxy support', async (t) => { const server = await createServer(); const proxy = await createProxy(); server.on('request', (req, res) => { - t.equal(req.url, '/_cluster/health/'); + t.equal(req.url, '/_cluster/health'); res.setHeader('content-type', 'application/json'); res.end(JSON.stringify({ hello: 'world' })); }); @@ -44,7 +44,7 @@ test('http-https proxy support', async (t) => { const server = await createSecureServer(); const proxy = await createProxy(); server.on('request', (req, res) => { - t.equal(req.url, '/_cluster/health/'); + t.equal(req.url, '/_cluster/health'); res.setHeader('content-type', 'application/json'); res.end(JSON.stringify({ hello: 'world' })); }); @@ -65,7 +65,7 @@ test('https-http proxy support', async (t) => { const server = await createServer(); const proxy = await createSecureProxy(); server.on('request', (req, res) => { - t.equal(req.url, '/_cluster/health/'); + t.equal(req.url, '/_cluster/health'); res.setHeader('content-type', 'application/json'); res.end(JSON.stringify({ hello: 'world' })); }); @@ -86,7 +86,7 @@ test('https-https proxy support', async (t) => { const server = await createSecureServer(); const proxy = await createSecureProxy(); server.on('request', (req, res) => { - t.equal(req.url, '/_cluster/health/'); + t.equal(req.url, '/_cluster/health'); res.setHeader('content-type', 'application/json'); res.end(JSON.stringify({ hello: 'world' })); }); @@ -107,7 +107,7 @@ test('http basic authentication', async (t) => { const server = await createServer(); const proxy = await createProxy(); server.on('request', (req, res) => { - t.equal(req.url, '/_cluster/health/'); + t.equal(req.url, '/_cluster/health'); res.setHeader('content-type', 'application/json'); res.end(JSON.stringify({ hello: 'world' })); }); @@ -136,7 +136,7 @@ test('https basic authentication', async (t) => { const server = await createSecureServer(); const proxy = await createProxy(); server.on('request', (req, res) => { - t.equal(req.url, '/_cluster/health/'); + t.equal(req.url, '/_cluster/health'); res.setHeader('content-type', 'application/json'); res.end(JSON.stringify({ hello: 'world' })); });