From 90d05fd9911596db33a20a164f92a51ffd067053 Mon Sep 17 00:00:00 2001 From: Stanisław Zagórowski Date: Fri, 19 Jan 2024 22:38:49 +0100 Subject: fix: body as string instead of table of numbers, write numbers and booleans to html --- src/luax/mod.rs | 2 ++ src/server.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luax/mod.rs b/src/luax/mod.rs index e5adc9a..70e7b34 100644 --- a/src/luax/mod.rs +++ b/src/luax/mod.rs @@ -63,6 +63,8 @@ pub fn table_to_html(table: rlua::Table, f: &mut W) -> Result match child? { rlua::Value::Table(child) => table_to_html(child, f)?, rlua::Value::String(s) => write!(f, "{}", s.to_str()?)?, + rlua::Value::Boolean(b) => write!(f, "{}", b)?, + rlua::Value::Number(n) => write!(f, "{}", n)?, _ => return Err(LuaXError::NonTableChildren.into()), } } diff --git a/src/server.rs b/src/server.rs index 307aa0c..7aa3cec 100644 --- a/src/server.rs +++ b/src/server.rs @@ -186,7 +186,7 @@ impl State { let route: rlua::Function = manifest.get("route")?; let method = method.as_str(); - let body: Vec = body.to_bytes().to_vec(); + let body: rlua::String = ctx.create_string(&body.to_bytes().to_vec())?; let res: rlua::Result<(rlua::Integer, rlua::Value)> = route.call((path.clone(), method, body)); -- cgit v1.3.1