From 411924b49790171ffbbb531db52dc6b39c7aeafb Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 13 Jan 2025 12:42:31 +0000 Subject: [PATCH] PR feedback. Limit API changes only to the S3 PR --- packages/frontend-core/src/api/attachments.ts | 1 + packages/frontend-core/src/api/index.ts | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/frontend-core/src/api/attachments.ts b/packages/frontend-core/src/api/attachments.ts index 0cedfb2cf1..e680218c8f 100644 --- a/packages/frontend-core/src/api/attachments.ts +++ b/packages/frontend-core/src/api/attachments.ts @@ -100,6 +100,7 @@ export const buildAttachmentEndpoints = ( body: data, json: false, external: true, + parseResponse: response => response as any, }) return { publicUrl } }, diff --git a/packages/frontend-core/src/api/index.ts b/packages/frontend-core/src/api/index.ts index d3209e0a54..6efc90023a 100644 --- a/packages/frontend-core/src/api/index.ts +++ b/packages/frontend-core/src/api/index.ts @@ -163,13 +163,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => { } else if (parseResponse) { return await parseResponse(response) } else { - const text = await response.text() - // If the response has no body at all e.g s3.put - if (!text) { - // Empty response - return {} as ResponseT - } - return JSON.parse(text) as ResponseT + return (await response.json()) as ResponseT } } catch (error) { delete cache[url]