Skip to content

Commit 183be5b

Browse files
committed
small ref
1 parent 1eef53a commit 183be5b

File tree

1 file changed

+9
-9
lines changed
  • packages/node/src/integrations

1 file changed

+9
-9
lines changed

packages/node/src/integrations/http.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,7 @@ function patchRequestToCaptureBody(req: HTTPModuleRequestIncomingMessage, normal
349349
const callback = new Proxy(listener, {
350350
apply: (target, thisArg, args: Parameters<typeof listener>) => {
351351
const chunk = args[0];
352-
try {
353-
chunks.push(chunk);
354-
} catch {
355-
// ignore errors here...
356-
}
352+
chunks.push(chunk);
357353
return Reflect.apply(target, thisArg, args);
358354
},
359355
});
@@ -366,11 +362,15 @@ function patchRequestToCaptureBody(req: HTTPModuleRequestIncomingMessage, normal
366362
if (event === 'end') {
367363
const callback = new Proxy(listener, {
368364
apply: (target, thisArg, args) => {
369-
const body = Buffer.concat(chunks).toString('utf-8');
365+
try {
366+
const body = Buffer.concat(chunks).toString('utf-8');
370367

371-
// We mutate the passed in normalizedRequest and add the body to it
372-
if (body) {
373-
normalizedRequest.data = body;
368+
// We mutate the passed in normalizedRequest and add the body to it
369+
if (body) {
370+
normalizedRequest.data = body;
371+
}
372+
} catch {
373+
// ignore errors here
374374
}
375375

376376
return Reflect.apply(target, thisArg, args);

0 commit comments

Comments
 (0)