Skip to content

Commit 8c66cf0

Browse files
authored
Merge pull request #1522 from sunnylqm/patch-1
fix head request
2 parents 94abb3c + 2e8b82f commit 8c66cf0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/compose.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,11 +2378,10 @@ export const composeGeneralHandler = (app: AnyElysia) => {
23782378
)
23792379
switchMap +=
23802380
`case 'HEAD':` +
2381-
`const _res=ht[${methods.GET ?? methods.ALL}].composed(c)\n` +
2382-
'return getResponseLength(_res).then((length)=>{' +
2381+
`return ht[${methods.GET ?? methods.ALL}].composed(c).then(_res=>getResponseLength(_res).then((length)=>{` +
23832382
`_res.headers.set('content-length', length)\n` +
23842383
`return new Response(null,{status:_res.status,statusText:_res.statusText,headers:_res.headers})\n` +
2385-
'})\n'
2384+
'}))\n'
23862385

23872386
for (const [method, index] of Object.entries(methods)) {
23882387
if (method === 'ALL' || method === 'GET' || method === 'WS')

0 commit comments

Comments
 (0)