File tree 2 files changed +8
-14
lines changed
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' ;
2
2
import { addNonEnumerableProperty } from '@sentry/utils' ;
3
3
import type { ResponseMiddleware } from '@solidjs/start/middleware' ;
4
4
import type { FetchEvent } from '@solidjs/start/server' ;
@@ -8,19 +8,13 @@ export type ResponseMiddlewareResponse = Parameters<ResponseMiddleware>[1] & {
8
8
} ;
9
9
10
10
function addMetaTagToHead ( html : string ) : string {
11
- const { 'sentry-trace' : sentryTrace , baggage } = getTraceData ( ) ;
11
+ const metaTags = getTraceMetaTags ( ) ;
12
12
13
- if ( ! sentryTrace ) {
13
+ if ( ! metaTags ) {
14
14
return html ;
15
15
}
16
16
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` ;
24
18
return html . replace ( '<head>' , content ) ;
25
19
}
26
20
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ import type { ResponseMiddlewareResponse } from '../src/middleware';
5
5
6
6
describe ( 'middleware' , ( ) => {
7
7
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
+ ` ) ;
12
12
13
13
const mockFetchEvent = {
14
14
request : { } ,
You can’t perform that action at this time.
0 commit comments