put POST data into params

This commit is contained in:
Chris Wanstrath 2025-11-05 14:53:50 -08:00
parent d48098b006
commit 68cd61227b

View File

@ -25,6 +25,13 @@ export function startWeb(rootPath: string) {
if (page === 'layout') return c.text('404 Not Found', 404) if (page === 'layout') return c.text('404 Not Found', 404)
const params = c.req.query() const params = c.req.query()
if (c.req.method === 'POST') {
const formData = await c.req.formData()
for (const [key, value] of formData.entries()) {
params[key] = value
}
}
const path = join(root, `${page}.sh`) const path = join(root, `${page}.sh`)
const file = Bun.file(path) const file = Bun.file(path)