From faba5e9db8e0d1fdc4845de6b504b4e2ea3ca72b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 7 Apr 2020 13:58:55 +0530 Subject: finally make linter happy --- src/headless/NodeHttpLib.ts | 33 ++++++++++++++++----------------- src/headless/integrationtest.ts | 4 ++-- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src/headless') 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 => { 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 { 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 { const walletDbPath = cfg.getString("integrationtest", "walletdb").required(); const bankBaseUrl = cfg -- cgit v1.2.3