mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
feat: move to new API
This commit is contained in:
parent
0c0d9a9ec3
commit
77bfb03ea6
2 changed files with 7 additions and 7 deletions
|
@ -45,7 +45,7 @@ export function generateProxyURL (type, data, opts) {
|
||||||
|
|
||||||
const scheme = opts.proxy.scheme ? opts.proxy.scheme : 'https'
|
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(
|
||||||
'&'
|
'&'
|
||||||
)}`
|
)}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,10 @@ describe('utils.generateProxyURL', () => {
|
||||||
}
|
}
|
||||||
expect(
|
expect(
|
||||||
utils.generateProxyURL('http', { domain: 'domain.org' }, opts)
|
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(
|
expect(
|
||||||
utils.generateProxyURL('dns', { domain: 'domain.org' }, opts)
|
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', () => {
|
it('should generate correct proxy URLs for explicit http scheme', () => {
|
||||||
const opts = {
|
const opts = {
|
||||||
|
@ -73,10 +73,10 @@ describe('utils.generateProxyURL', () => {
|
||||||
}
|
}
|
||||||
expect(
|
expect(
|
||||||
utils.generateProxyURL('http', { domain: 'domain.org' }, opts)
|
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(
|
expect(
|
||||||
utils.generateProxyURL('dns', { domain: 'domain.org' }, opts)
|
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', () => {
|
it('should generate correct proxy URLs for default scheme', () => {
|
||||||
const opts = {
|
const opts = {
|
||||||
|
@ -86,10 +86,10 @@ describe('utils.generateProxyURL', () => {
|
||||||
}
|
}
|
||||||
expect(
|
expect(
|
||||||
utils.generateProxyURL('http', { domain: 'domain.org' }, opts)
|
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(
|
expect(
|
||||||
utils.generateProxyURL('dns', { domain: 'domain.org' }, opts)
|
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')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue