Skip to content

Commit 27a400b

Browse files
committed
even more cleanup
1 parent 8206db6 commit 27a400b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/node-core/src/utils/outgoingFetchRequest.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function stringToArrayHeaders(requestHeaders: string): string[] {
9797
}
9898
const key = header.slice(0, colonIndex).trim();
9999
const value = header.slice(colonIndex + 1).trim();
100-
if (key && value) {
100+
if (key) {
101101
headers.push(key, value);
102102
}
103103
} catch {}
@@ -107,9 +107,13 @@ function stringToArrayHeaders(requestHeaders: string): string[] {
107107

108108
function arrayToStringHeaders(headers: string[]): string {
109109
const headerPairs: string[] = [];
110-
for (let i = 0; i < headers.length; i += 2) {
111-
headerPairs.push(`${headers[i]}: ${headers[i + 1]}`);
112-
}
110+
111+
try {
112+
for (let i = 0; i < headers.length; i += 2) {
113+
headerPairs.push(`${headers[i]}: ${headers[i + 1]}`);
114+
}
115+
} catch {}
116+
113117
if (!headerPairs.length) {
114118
return '';
115119
}

packages/node-core/src/utils/outgoingHttpRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function addTracePropagationHeadersToOutgoingRequest(
6666

6767
const { 'sentry-trace': sentryTrace, baggage, traceparent } = headersToAdd;
6868

69-
const hasExistingSentryTraceHeader = request.getHeader('sentry-trace');
69+
const hasExistingSentryTraceHeader = !!request.getHeader('sentry-trace');
7070

7171
if (sentryTrace && !hasExistingSentryTraceHeader) {
7272
try {

0 commit comments

Comments
 (0)