File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/node/src/integrations/undici Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -309,8 +309,13 @@ function setHeadersOnRequest(
309
309
sentryTrace : string ,
310
310
sentryBaggageHeader : string | undefined ,
311
311
) : void {
312
- const headerLines = request . headers . split ( '\r\n' ) ;
313
- const hasSentryHeaders = headerLines . some ( headerLine => headerLine . startsWith ( 'sentry-trace:' ) ) ;
312
+ let hasSentryHeaders : boolean ;
313
+ if ( Array . isArray ( request . headers ) ) {
314
+ hasSentryHeaders = request . headers . some ( headerLine => headerLine === 'sentry-trace' ) ;
315
+ } else {
316
+ const headerLines = request . headers . split ( '\r\n' ) ;
317
+ hasSentryHeaders = headerLines . some ( headerLine => headerLine . startsWith ( 'sentry-trace:' ) ) ;
318
+ }
314
319
315
320
if ( hasSentryHeaders ) {
316
321
return ;
Original file line number Diff line number Diff line change @@ -224,7 +224,9 @@ export interface UndiciRequest {
224
224
// Originally was Dispatcher.HttpMethod, but did not want to vendor that in.
225
225
method ?: string ;
226
226
path : string ;
227
- headers : string ;
227
+ // string for undici@<=6.6.2 and string[] for undici@>=6.7.0.
228
+ // see for more information: https://github.com/getsentry/sentry-javascript/issues/10936
229
+ headers : string | string [ ] ;
228
230
addHeader ( key : string , value : string ) : RequestWithSentry ;
229
231
}
230
232
You can’t perform that action at this time.
0 commit comments