diff --git a/lib/httpadapter/fetchadapter.js b/lib/httpadapter/fetchadapter.js index 030c092..6085439 100644 --- a/lib/httpadapter/fetchadapter.js +++ b/lib/httpadapter/fetchadapter.js @@ -42,10 +42,11 @@ class FetchAdapter { if (fullResponse) { return res; } + const rawResponseBody = await res.text(); try { - return await res.json(); + return JSON.parse(rawResponseBody); } catch (e) { - throw new HttpError(await res.text(), { + throw new HttpError(rawResponseBody, { code: res.statusCode }); }