We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01ea7d0 commit 2a8c873Copy full SHA for 2a8c873
1 file changed
packages/@http/src/HTTPTest.ts
@@ -58,16 +58,12 @@ export class HTTPTest extends Test<IResponse> {
58
reqOptions.protocol = `http${reqOptions.https ? "s" : ""}:`;
59
60
const req: ClientRequest = (reqOptions.https ? httpsRequest : httpRequest)(reqOptions, (res) => {
61
- const body: Buffer[] = [];
62
- res.on("data", (chunk: Buffer) => {
63
- body.push(chunk);
64
- });
65
- res.on("end", () => {
+ res.on("data", (body: Buffer) => {
66
let parsedBody: unknown;
67
try {
68
- parsedBody = JSON.parse(Buffer.concat(body).toString());
+ parsedBody = JSON.parse(body.toString());
69
} catch {
70
- parsedBody = Buffer.concat(body).toString();
+ parsedBody = body.toString();
71
}
72
73
resolve({
0 commit comments