File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change 1- import { getTraceData } from '@sentry/core' ;
1+ import { getTraceMetaTags } from '@sentry/core' ;
22import { addNonEnumerableProperty } from '@sentry/utils' ;
33import type { ResponseMiddleware } from '@solidjs/start/middleware' ;
44import type { FetchEvent } from '@solidjs/start/server' ;
@@ -8,19 +8,13 @@ export type ResponseMiddlewareResponse = Parameters<ResponseMiddleware>[1] & {
88} ;
99
1010function addMetaTagToHead ( html : string ) : string {
11- const { 'sentry-trace' : sentryTrace , baggage } = getTraceData ( ) ;
11+ const metaTags = getTraceMetaTags ( ) ;
1212
13- if ( ! sentryTrace ) {
13+ if ( ! metaTags ) {
1414 return html ;
1515 }
1616
17- const metaTags = [ `<meta name="sentry-trace" content="${ sentryTrace } ">` ] ;
18-
19- if ( baggage ) {
20- metaTags . push ( `<meta name="baggage" content="${ baggage } ">` ) ;
21- }
22-
23- const content = `<head>\n${ metaTags . join ( '\n' ) } \n` ;
17+ const content = `<head>\n${ metaTags } \n` ;
2418 return html . replace ( '<head>' , content ) ;
2519}
2620
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ import type { ResponseMiddlewareResponse } from '../src/middleware';
55
66describe ( 'middleware' , ( ) => {
77 describe ( 'sentryBeforeResponseMiddleware' , ( ) => {
8- vi . spyOn ( SentryCore , 'getTraceData ' ) . mockReturnValue ( {
9- ' sentry-trace' : ' 123' ,
10- baggage : ' abc' ,
11- } ) ;
8+ vi . spyOn ( SentryCore , 'getTraceMetaTags ' ) . mockReturnValue ( `
9+ <meta name=" sentry-trace" content=" 123"> ,
10+ <meta name=" baggage" content=" abc">
11+ ` ) ;
1212
1313 const mockFetchEvent = {
1414 request : { } ,
You can’t perform that action at this time.
0 commit comments