From 77bfb03ea6cb1a183aaab586b9139348f7b82ad5 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 13 Jul 2023 10:38:13 +0200 Subject: [PATCH] feat: move to new API --- src/utils.js | 2 +- test/utils.test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils.js b/src/utils.js index ed6bcc7..e6f7387 100644 --- a/src/utils.js +++ b/src/utils.js @@ -45,7 +45,7 @@ export function generateProxyURL (type, data, opts) { const scheme = opts.proxy.scheme ? opts.proxy.scheme : 'https' - return `${scheme}://${opts.proxy.hostname}/api/2/get/${type}?${queryStrings.join( + return `${scheme}://${opts.proxy.hostname}/api/3/get/${type}?${queryStrings.join( '&' )}` } diff --git a/test/utils.test.js b/test/utils.test.js index 23c2b5b..97483d4 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -59,10 +59,10 @@ describe('utils.generateProxyURL', () => { } expect( utils.generateProxyURL('http', { domain: 'domain.org' }, opts) - ).to.equal('https://localhost/api/2/get/http?domain=domain.org') + ).to.equal('https://localhost/api/3/get/http?domain=domain.org') expect( utils.generateProxyURL('dns', { domain: 'domain.org' }, opts) - ).to.equal('https://localhost/api/2/get/dns?domain=domain.org') + ).to.equal('https://localhost/api/3/get/dns?domain=domain.org') }) it('should generate correct proxy URLs for explicit http scheme', () => { const opts = { @@ -73,10 +73,10 @@ describe('utils.generateProxyURL', () => { } expect( utils.generateProxyURL('http', { domain: 'domain.org' }, opts) - ).to.equal('http://localhost/api/2/get/http?domain=domain.org') + ).to.equal('http://localhost/api/3/get/http?domain=domain.org') expect( utils.generateProxyURL('dns', { domain: 'domain.org' }, opts) - ).to.equal('http://localhost/api/2/get/dns?domain=domain.org') + ).to.equal('http://localhost/api/3/get/dns?domain=domain.org') }) it('should generate correct proxy URLs for default scheme', () => { const opts = { @@ -86,10 +86,10 @@ describe('utils.generateProxyURL', () => { } expect( utils.generateProxyURL('http', { domain: 'domain.org' }, opts) - ).to.equal('https://localhost/api/2/get/http?domain=domain.org') + ).to.equal('https://localhost/api/3/get/http?domain=domain.org') expect( utils.generateProxyURL('dns', { domain: 'domain.org' }, opts) - ).to.equal('https://localhost/api/2/get/dns?domain=domain.org') + ).to.equal('https://localhost/api/3/get/dns?domain=domain.org') })