File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/astro/src/server Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,7 @@ async function instrumentRequest(
91
91
}
92
92
addNonEnumerableProperty ( locals , '__sentry_wrapped__' , true ) ;
93
93
94
- const method = ctx . request . method ;
95
- const headers = ctx . request . headers ;
94
+ const { method, headers } = ctx . request ;
96
95
97
96
const traceCtx = continueTrace ( {
98
97
sentryTrace : headers . get ( 'sentry-trace' ) || undefined ,
@@ -160,10 +159,12 @@ async function instrumentRequest(
160
159
return originalResponse ;
161
160
}
162
161
162
+ const decoder = new TextDecoder ( ) ;
163
+
163
164
const newResponseStream = new ReadableStream ( {
164
165
start : async controller => {
165
166
for await ( const chunk of originalBody ) {
166
- const html = typeof chunk === 'string' ? chunk : new TextDecoder ( ) . decode ( chunk ) ;
167
+ const html = typeof chunk === 'string' ? chunk : decoder . decode ( chunk ) ;
167
168
const modifiedHtml = addMetaTagToHead ( html , hub , span ) ;
168
169
controller . enqueue ( new TextEncoder ( ) . encode ( modifiedHtml ) ) ;
169
170
}
You can’t perform that action at this time.
0 commit comments