Skip to content

Commit

Permalink
fix: throw error when the body is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
justheimsk committed Jun 27, 2024
1 parent 0c96235 commit 86e048b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/rest/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class RequestManager {
// Criar uma classe de resposta da API.
res.on('end', () => {
try {
const parsed = JSON.parse(body);
const parsed = body.length ? JSON.parse(body) : {};
if (res.statusCode === 200) {
resolve(parsed);
} else {
Expand Down

0 comments on commit 86e048b

Please sign in to comment.