Skip to content

Commit f13d4c6

Browse files
authored
fix: fetch headers if array (getsentry#2096)
* fix: fetch headers if array * meta: Changelog
1 parent 62436ff commit f13d4c6

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 5.4.1
4+
5+
- [integrations] fix: Tracing integration fetch headers bug.
6+
37
## 5.4.0
48

59
- [global] feat: Exposed new simplified scope API. `Sentry.setTag`, `Sentry.setTags`, `Sentry.setExtra`, `Sentry.setExtras`, `Sentry.setUser`, `Sentry.setContext`

packages/integrations/src/tracing.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,14 @@ export class Tracing implements Integration {
162162

163163
if (options && whiteListed) {
164164
if (options.headers) {
165-
options.headers = {
166-
...options.headers,
167-
...getCurrentHub().traceHeaders(),
168-
};
165+
if (Array.isArray(options.headers)) {
166+
options.headers = [...options.headers, ...Object.entries(getCurrentHub().traceHeaders())];
167+
} else {
168+
options.headers = {
169+
...options.headers,
170+
...getCurrentHub().traceHeaders(),
171+
};
172+
}
169173
} else {
170174
options.headers = getCurrentHub().traceHeaders();
171175
}

0 commit comments

Comments
 (0)