From 3575c31d9bbaad9b8e05834d1643ffbe82c2e880 Mon Sep 17 00:00:00 2001 From: Alex Layton Date: Sun, 12 Feb 2023 14:32:06 -0500 Subject: [PATCH] fix(http): let client decide http(s) version to use --- src/config.ts | 7 ------- src/index.ts | 3 +-- test/external.test.ts | 5 ++--- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/config.ts b/src/config.ts index 0a5f0e5..8bdb2e5 100644 --- a/src/config.ts +++ b/src/config.ts @@ -27,13 +27,6 @@ const config = convict({ env: 'DOMAIN', arg: 'domain', }, - mode: { - doc: 'Specific HTTP or HTTPS for OADA API connection', - format: ['http', 'https'], - default: 'https' as 'http' | 'https', - env: 'HTTP_MODE', - arg: 'mode', - }, token: { doc: 'OADA API token', format: Array, diff --git a/src/index.ts b/src/index.ts index 52a081d..09f1a00 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,6 @@ const fatal = debug('unfisk:fatal'); // Tolerant of https or not https on domain const domain = config.get('oada.domain').replace(/^https?:\/\//, ''); -const mode = config.get('oada.mode'); const tokens = config.get('oada.token'); const flat = config.get('lists.flat'); const unflat = config.get('lists.unflat'); // Day-index will be added to this @@ -51,7 +50,7 @@ async function unfisk(token: string) { // Connect to the OADA API const conn = oada ? oada.clone(token) - : (oada = await connect({ token, domain: `${mode}://${domain}` })); + : (oada = await connect({ token, domain })); await ensureAllPathsExist(conn); diff --git a/test/external.test.ts b/test/external.test.ts index bb8cb00..78fc037 100644 --- a/test/external.test.ts +++ b/test/external.test.ts @@ -29,8 +29,7 @@ import testasn from './testasn.js'; // DO NOT include ../ because we are testing externally. -const domain = config.get('oada.domain').replace(/^https?:\/\//, ''); -const mode = config.get('oada.mode'); +const domain = config.get('oada.domain'); const token = config.get('oada.token')[0]!; const asnKey = 'UNFISK_TEST_ASN1'; @@ -38,7 +37,7 @@ const asnID = `resources/${asnKey}`; let conn: OADAClient; test.before(async () => { - conn = await connect({ token, domain: `${mode}://${domain}` }); + conn = await connect({ token, domain }); }); test.after(async () => {