Skip to content

Commit

Permalink
Merge pull request #6 from dfinity/main
Browse files Browse the repository at this point in the history
fix: Only clone and convert response to text when there is an error. …
  • Loading branch information
sea-snake committed Oct 6, 2022
2 parents 7260e1a + fc3d3d0 commit a5d05a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/agent/src/agent/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ export class HttpAgent implements Agent {
);
}
const response = await request();
const responseText = await response.clone().text();
if (!response.ok) {
const responseText = await response.clone().text();
const errorMessage =
`Server returned an error:\n` +
` Code: ${response.status} (${response.statusText})\n` +
Expand Down

0 comments on commit a5d05a2

Please sign in to comment.