summaryrefslogtreecommitdiff
path: root/src/util/http.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-04-07 13:37:32 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-04-07 13:37:32 +0530
commitfb2e2f89935240666de66e4b2c11125cb3b2943d (patch)
tree7b7e148e6cce7bf7639a5e35102f5269f5920ab5 /src/util/http.ts
parent1471aae8927c20d646cc2aa5ab0e20c1a7f2c0ca (diff)
downloadwallet-core-fb2e2f89935240666de66e4b2c11125cb3b2943d.tar.gz
wallet-core-fb2e2f89935240666de66e4b2c11125cb3b2943d.tar.bz2
wallet-core-fb2e2f89935240666de66e4b2c11125cb3b2943d.zip
more lint fixes
Diffstat (limited to 'src/util/http.ts')
-rw-r--r--src/util/http.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/util/http.ts b/src/util/http.ts
index 3842347dc..0ac989a17 100644
--- a/src/util/http.ts
+++ b/src/util/http.ts
@@ -136,9 +136,13 @@ export class BrowserHttpLib implements HttpRequestLibrary {
const headerMap = new Headers();
arr.forEach(function (line) {
const parts = line.split(": ");
- const header = parts.shift();
+ const headerName = parts.shift();
+ if (!headerName) {
+ console.error("invalid header");
+ return;
+ }
const value = parts.join(": ");
- headerMap.set(header!, value);
+ headerMap.set(headerName, value);
});
const resp: HttpResponse = {
status: myRequest.status,
@@ -156,7 +160,11 @@ export class BrowserHttpLib implements HttpRequestLibrary {
return this.req("get", url, undefined, opt);
}
- postJson(url: string, body: any, opt?: HttpRequestOptions): Promise<HttpResponse> {
+ postJson(
+ url: string,
+ body: any,
+ opt?: HttpRequestOptions,
+ ): Promise<HttpResponse> {
return this.req("post", url, JSON.stringify(body), opt);
}