diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-04-07 13:58:55 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-04-07 13:58:55 +0530 |
commit | faba5e9db8e0d1fdc4845de6b504b4e2ea3ca72b (patch) | |
tree | 53bbc26d9e5d16e168e682ce808461a395e00f45 /src/headless | |
parent | fb2e2f89935240666de66e4b2c11125cb3b2943d (diff) |
finally make linter happy
Diffstat (limited to 'src/headless')
-rw-r--r-- | src/headless/NodeHttpLib.ts | 33 | ||||
-rw-r--r-- | src/headless/integrationtest.ts | 4 |
2 files changed, 18 insertions, 19 deletions
diff --git a/src/headless/NodeHttpLib.ts b/src/headless/NodeHttpLib.ts index 735d6b3cf..118fb9e96 100644 --- a/src/headless/NodeHttpLib.ts +++ b/src/headless/NodeHttpLib.ts @@ -16,6 +16,9 @@ SPDX-License-Identifier: AGPL3.0-or-later */ +/** + * Imports. + */ import { Headers, HttpRequestLibrary, @@ -23,7 +26,7 @@ import { HttpResponse, } from "../util/http"; import { RequestThrottler } from "../util/RequestThrottler"; -import Axios, { AxiosResponse } from "axios"; +import Axios from "axios"; /** * Implementation of the HTTP request library interface for node. @@ -35,7 +38,7 @@ export class NodeHttpLib implements HttpRequestLibrary { /** * Set whether requests should be throttled. */ - setThrottling(enabled: boolean) { + setThrottling(enabled: boolean): void { this.throttlingEnabled = enabled; } @@ -48,25 +51,21 @@ export class NodeHttpLib implements HttpRequestLibrary { if (this.throttlingEnabled && this.throttle.applyThrottle(url)) { throw Error("request throttled"); } - let resp: AxiosResponse; - try { - resp = await Axios({ - method, - url: url, - responseType: "text", - headers: opt?.headers, - validateStatus: () => true, - transformResponse: (x) => x, - data: body, - }); - } catch (e) { - throw e; - } + const resp = await Axios({ + method, + url: url, + responseType: "text", + headers: opt?.headers, + validateStatus: () => true, + transformResponse: (x) => x, + data: body, + }); + const respText = resp.data; if (typeof respText !== "string") { throw Error("unexpected response type"); } - const makeJson = async () => { + const makeJson = async (): Promise<any> => { let responseJson; try { responseJson = JSON.parse(respText); diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts index 9934f2048..24ceb9ce0 100644 --- a/src/headless/integrationtest.ts +++ b/src/headless/integrationtest.ts @@ -88,7 +88,7 @@ async function makePayment( }; } -export async function runIntegrationTest(args: IntegrationTestArgs) { +export async function runIntegrationTest(args: IntegrationTestArgs): Promise<void> { logger.info("running test with arguments", args); const parsedSpendAmount = Amounts.parseOrThrow(args.amountToSpend); @@ -196,7 +196,7 @@ export async function runIntegrationTest(args: IntegrationTestArgs) { ); } -export async function runIntegrationTestBasic(cfg: Configuration) { +export async function runIntegrationTestBasic(cfg: Configuration): Promise<void> { const walletDbPath = cfg.getString("integrationtest", "walletdb").required(); const bankBaseUrl = cfg |