Skip to content

Commit

Permalink
fix: Only clone and convert response to text when there is an error. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-snake committed Oct 6, 2022
1 parent a3b3224 commit fc3d3d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/agent/src/agent/http/index.ts
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 fc3d3d0

Please sign in to comment.