Skip to content

Commit

Permalink
fix(cache): only spy on end/write for string chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 18, 2022
1 parent 1ed98f5 commit bd0b1ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/runtime/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,17 @@ export function defineCachedEventHandler <T=any> (
removeHeader (name) { delete resHeaders[name] },
getHeaders () { return resHeaders },
end (chunk, arg2?, arg3?) {
_resSendBody = chunk
if (typeof chunk === 'string') {
_resSendBody = chunk
}
if (typeof arg2 === 'function') { arg2() }
if (typeof arg3 === 'function') { arg3() }
return this
},
write (chunk, arg2?, arg3?) {
_resSendBody = chunk
if (typeof chunk === 'string') {
_resSendBody = chunk
}
if (typeof arg2 === 'function') { arg2() }
if (typeof arg3 === 'function') { arg3() }
return this
Expand Down

0 comments on commit bd0b1ed

Please sign in to comment.