Skip to content

Commit

Permalink
fix: body used already error fix #340 (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephigenia authored Jun 19, 2024
1 parent e225f77 commit 26af5e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/httpadapter/fetchadapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down

0 comments on commit 26af5e0

Please sign in to comment.