[Poly > Request] Add encoding null support
This commit is contained in:
parent
82eaca1f72
commit
d335ad57fc
|
@ -58,16 +58,16 @@ const request = (...args) => {
|
|||
|
||||
listeners['response']?.(res);
|
||||
|
||||
let body = '';
|
||||
|
||||
let data = [];
|
||||
res.on('data', (chunk) => {
|
||||
body += chunk;
|
||||
data.push(chunk);
|
||||
listeners['data']?.(chunk);
|
||||
});
|
||||
|
||||
await new Promise((resolve) => res.on('end', resolve)); // Wait to read full body
|
||||
|
||||
callback?.(undefined, res, body);
|
||||
const buf = Buffer.concat(data);
|
||||
callback?.(undefined, res, options.encoding !== null ? buf.toString() : buf);
|
||||
});
|
||||
|
||||
const ret = {
|
||||
|
|
Loading…
Reference in New Issue