aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src/http_client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/connect/src/http_client.ts')
-rw-r--r--packages/connect/src/http_client.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index 9e5f0f448..cf0aaef0d 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -172,13 +172,12 @@ export class HttpClient implements Client {
body: JSON.stringify(payload),
headers,
});
- const json = await response.json();
+ const text = await response.text();
if (!response.ok) {
- const errorString = `${response.status} - ${response.statusText}\n${requestType} ${url}\n${JSON.stringify(
- json,
- )}`;
+ const errorString = `${response.status} - ${response.statusText}\n${requestType} ${url}\n${text}`;
throw Error(errorString);
}
- return json;
+ const result = !_.isEmpty(text) ? JSON.parse(text) : undefined;
+ return result;
}
}