mirror of
https://github.com/Wessel/wumpfetch.git
synced 2026-06-06 07:35:42 +02:00
Update WumpResponse.js
This commit is contained in:
@@ -11,6 +11,11 @@ module.exports = class WumpResponse {
|
||||
this.body = Buffer.concat([ this.body, chunk ]);
|
||||
}
|
||||
|
||||
parse () {
|
||||
if (this.headers['content-type'] === 'application/json') return JSON.parse(this.body);
|
||||
else return this.body.toString();
|
||||
}
|
||||
|
||||
buffer () {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user