File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -2291,18 +2291,21 @@ export const composeGeneralHandler = (app: AnyElysia) => {
22912291
22922292 if ( isWebstandard )
22932293 findDynamicRoute +=
2294- `if(r.method===' HEAD' ){` +
2295- `const route=router.find(' GET' ,p)\n ` +
2296- ' if(route){' +
2297- `c.params=route.params\n ` +
2298- `const _res=route.store.handler?route.store.handler(c):route.store.compile()(c)\n ` +
2294+ `if(r.method===" HEAD" ){` +
2295+ `const route=router.find(" GET" ,p); ` +
2296+ ` if(route){` +
2297+ `c.params=route.params; ` +
2298+ `const _res=route.store.handler?route.store.handler(c):route.store.compile()(c); ` +
22992299 `if(_res)` +
2300- 'return getResponseLength(_res).then((length)=>{' +
2301- `_res.headers.set('content-length', length)\n` +
2302- `return new Response(null,{status:_res.status,statusText:_res.statusText,headers:_res.headers})\n` +
2303- '})' +
2304- '}' +
2305- '}'
2300+ `return Promise.resolve(_res).then((_res)=>{` +
2301+ `if(!_res.headers)_res.headers=new Headers();` +
2302+ `return getResponseLength(_res).then((length)=>{` +
2303+ `_res.headers.set("content-length", length);` +
2304+ `return new Response(null,{status:_res.status,statusText:_res.statusText,headers:_res.headers});` +
2305+ `})` +
2306+ `});` +
2307+ `}` +
2308+ `}`
23062309
23072310 let afterResponse = `c.error=notFound\n`
23082311 if ( app . event . afterResponse ?. length && ! app . event . error ) {
You can’t perform that action at this time.
0 commit comments