diff --git a/src/compose.ts b/src/compose.ts index b0b88d79..27579a6b 100644 --- a/src/compose.ts +++ b/src/compose.ts @@ -2381,18 +2381,10 @@ export const composeGeneralHandler = (app: AnyElysia) => { ) switchMap += `case 'HEAD':` + - `const _ht=ht[${methods.GET ?? methods.ALL}].composed(c)\n` + - `if(typeof _ht === 'function') {return _ht` + - `.then(_res=>getResponseLength(_res).then((length)=>{` + - `_res.headers.set('content-length', length)\n` + - `return new Response(null,{status:_res.status,statusText:_res.statusText,headers:_res.headers})\n` + - '}))\n' + - `}else{` + - `return getResponseLength(_ht).then((length)=>{` + + `return Promise.resolve(ht[${methods.GET ?? methods.ALL}].composed(c)).then(_ht=>getResponseLength(_ht).then((length)=>{` + `_ht.headers.set('content-length', length)\n` + `return new Response(null,{status:_ht.status,statusText:_ht.statusText,headers:_ht.headers})\n` + - `})` + - `}\n` + `}))\n` for (const [method, index] of Object.entries(methods)) { if (method === 'ALL' || method === 'GET' || method === 'WS')