From 5d45b0bda988c1945f2e8cc4d7e7763b53f1e7b6 Mon Sep 17 00:00:00 2001 From: ITOH Date: Tue, 11 May 2021 19:20:15 +0200 Subject: [PATCH 1/4] fix: return undefined on 204 status --- src/rest/run_method.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index 5593b89d5..17f9cebde 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -9,7 +9,7 @@ export async function runMethod( url: string, body?: unknown, retryCount = 0, - bucketId?: string, + bucketId?: string ): Promise { if (body) { body = loopObject( @@ -18,9 +18,9 @@ export async function runMethod( typeof value === "bigint" ? value.toString() : Array.isArray(value) - ? value.map((v) => typeof v === "bigint" ? v.toString() : v) + ? value.map((v) => (typeof v === "bigint" ? v.toString() : v)) : value, - `Running forEach loop in runMethod function for changing bigints to strings.`, + `Running forEach loop in runMethod function for changing bigints to strings.` ); } @@ -62,13 +62,17 @@ export async function runMethod( method, reject, respond: (data: { status: number; body?: string }) => - resolve(camelize(JSON.parse(data.body || "{}"))), + resolve( + data.status !== 204 + ? camelize(JSON.parse(data.body ?? "{}")) + : (undefined) + ), }, { bucketId, body: body as Record | undefined, retryCount, - }, + } ); }); } From e8b6230f103e58b8bd10c66c70d935fcd3cf4f74 Mon Sep 17 00:00:00 2001 From: itohatweb Date: Tue, 11 May 2021 17:20:38 +0000 Subject: [PATCH 2/4] Commit from GitHub Actions (Lint) --- src/rest/run_method.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index 17f9cebde..b38c6c984 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -9,7 +9,7 @@ export async function runMethod( url: string, body?: unknown, retryCount = 0, - bucketId?: string + bucketId?: string, ): Promise { if (body) { body = loopObject( @@ -20,7 +20,7 @@ export async function runMethod( : Array.isArray(value) ? value.map((v) => (typeof v === "bigint" ? v.toString() : v)) : value, - `Running forEach loop in runMethod function for changing bigints to strings.` + `Running forEach loop in runMethod function for changing bigints to strings.`, ); } @@ -65,14 +65,14 @@ export async function runMethod( resolve( data.status !== 204 ? camelize(JSON.parse(data.body ?? "{}")) - : (undefined) + : ( undefined), ), }, { bucketId, body: body as Record | undefined, retryCount, - } + }, ); }); } From 1da04ed63928ab899fee5f3dbdd80424021fde40 Mon Sep 17 00:00:00 2001 From: ITOH Date: Tue, 11 May 2021 19:39:49 +0200 Subject: [PATCH 3/4] use as --- src/rest/run_method.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index 17f9cebde..b23d424c8 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -9,7 +9,7 @@ export async function runMethod( url: string, body?: unknown, retryCount = 0, - bucketId?: string + bucketId?: string, ): Promise { if (body) { body = loopObject( @@ -20,7 +20,7 @@ export async function runMethod( : Array.isArray(value) ? value.map((v) => (typeof v === "bigint" ? v.toString() : v)) : value, - `Running forEach loop in runMethod function for changing bigints to strings.` + `Running forEach loop in runMethod function for changing bigints to strings.`, ); } @@ -65,14 +65,14 @@ export async function runMethod( resolve( data.status !== 204 ? camelize(JSON.parse(data.body ?? "{}")) - : (undefined) + : ((undefined as unknown) as T), ), }, { bucketId, body: body as Record | undefined, retryCount, - } + }, ); }); } From 0dff29735b0fa6137db89ff23ca677f44071d1b7 Mon Sep 17 00:00:00 2001 From: itohatweb Date: Tue, 11 May 2021 17:40:35 +0000 Subject: [PATCH 4/4] Commit from GitHub Actions (Lint) --- src/rest/run_method.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index 9590e9de5..b23d424c8 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -9,7 +9,7 @@ export async function runMethod( url: string, body?: unknown, retryCount = 0, - bucketId?: string + bucketId?: string, ): Promise { if (body) { body = loopObject( @@ -20,7 +20,7 @@ export async function runMethod( : Array.isArray(value) ? value.map((v) => (typeof v === "bigint" ? v.toString() : v)) : value, - `Running forEach loop in runMethod function for changing bigints to strings.` + `Running forEach loop in runMethod function for changing bigints to strings.`, ); } @@ -65,14 +65,14 @@ export async function runMethod( resolve( data.status !== 204 ? camelize(JSON.parse(data.body ?? "{}")) - : ((undefined as unknown) as T) + : ((undefined as unknown) as T), ), }, { bucketId, body: body as Record | undefined, retryCount, - } + }, ); }); }