@@ -7,7 +7,9 @@ const { DEFAULT_SENTRY_TRACE, DEFAULT_BAGGAGE } = vi.hoisted(() => ({
77} ) ) ;
88
99const CUSTOM_SENTRY_TRACE = '123-abc-1' ;
10- const CUSTOM_BAGGAGE = 'sentry-trace_id=123,sentry-sampled=true' ;
10+ // adding in random spaces here to ensure they are trimmed and our sentry baggage item detection logic works.
11+ // Spaces between items are allowed by the baggage spec.
12+ const CUSTOM_BAGGAGE = ' sentry-trace_id=123 , sentry-sampled=true' ;
1113
1214vi . mock ( '../../src/utils/traceData' , ( ) => {
1315 return {
@@ -156,7 +158,7 @@ describe('_addTracingHeadersToFetchRequest', () => {
156158 expect ( Object . fromEntries ( returnedHeaders ! . entries ( ) ) ) . toEqual ( {
157159 'custom-header' : 'custom-value' ,
158160 'sentry-trace' : CUSTOM_SENTRY_TRACE ,
159- baggage : CUSTOM_BAGGAGE ,
161+ baggage : CUSTOM_BAGGAGE . trim ( ) ,
160162 } ) ;
161163 } ) ;
162164
@@ -359,7 +361,7 @@ describe('_addTracingHeadersToFetchRequest', () => {
359361 expect ( Object . fromEntries ( returnedHeaders ! . entries ( ) ) ) . toEqual ( {
360362 'custom-header' : 'custom-value' ,
361363 'sentry-trace' : CUSTOM_SENTRY_TRACE ,
362- baggage : CUSTOM_BAGGAGE ,
364+ baggage : CUSTOM_BAGGAGE . trim ( ) ,
363365 } ) ;
364366 } ) ;
365367
@@ -380,7 +382,7 @@ describe('_addTracingHeadersToFetchRequest', () => {
380382 expect ( Object . fromEntries ( returnedHeaders ! . entries ( ) ) ) . toEqual ( {
381383 'custom-header' : 'custom-value' ,
382384 'sentry-trace' : CUSTOM_SENTRY_TRACE ,
383- baggage : CUSTOM_BAGGAGE ,
385+ baggage : CUSTOM_BAGGAGE . trim ( ) ,
384386 } ) ;
385387 } ) ;
386388
@@ -401,7 +403,7 @@ describe('_addTracingHeadersToFetchRequest', () => {
401403 expect ( Object . fromEntries ( returnedHeaders ! . entries ( ) ) ) . toEqual ( {
402404 'custom-header' : 'custom-value' ,
403405 'sentry-trace' : CUSTOM_SENTRY_TRACE ,
404- baggage : CUSTOM_BAGGAGE ,
406+ baggage : CUSTOM_BAGGAGE . trim ( ) ,
405407 } ) ;
406408 } ) ;
407409 } ) ;
0 commit comments