Skip to content

Commit

Permalink
fix: Parse only json response
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed May 30, 2022
1 parent 2b87125 commit cb5041f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/REST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export class REST {
}).finally(() => clearTimeout(timeout));

if (res.ok) {
return res.json();
if (res.headers.get('Content-Type')?.startsWith('application/json')) {
return res.json();
}
return res.arrayBuffer();
}

// TODO: Handle Rate limits
Expand Down

0 comments on commit cb5041f

Please sign in to comment.