support async components
This commit is contained in:
parent
d5e0dbd2db
commit
e35aef35cd
|
|
@ -79,13 +79,13 @@ async function loadApp(path: string): Promise<App | undefined> {
|
|||
return mod.default as App
|
||||
}
|
||||
|
||||
export function toResponse(source: string | Child | Response): Response {
|
||||
export async function toResponse(source: string | Child | Response): Promise<Response> {
|
||||
if (source instanceof Response)
|
||||
return source
|
||||
else if (typeof source === "string")
|
||||
return new Response(source)
|
||||
else
|
||||
return new Response(renderToString(source), {
|
||||
return new Response(await source?.toString(), {
|
||||
headers: {
|
||||
"Content-Type": "text/html; charset=utf-8"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user