From 83527a7f598d57ce7c8762ee508941405d09a1a9 Mon Sep 17 00:00:00 2001 From: ato Date: Thu, 16 Feb 2023 19:03:55 +0100 Subject: [PATCH] fix: correct return from lua res --- src/internal/core/service.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/internal/core/service.rs b/src/internal/core/service.rs index ac8ae7a..df78520 100644 --- a/src/internal/core/service.rs +++ b/src/internal/core/service.rs @@ -132,10 +132,13 @@ impl Service> for Svc { .unwrap(); match handler.call_async::<_, Res>((req, res)).await { - Ok(res) => Ok(Response::builder() - .status(res.status) - .body(Body::from(res.body)) - .unwrap()), + Ok(res) => { + let body = if res.json != "" { res.json } else { res.body }; + Ok(Response::builder() + .status(res.status) + .body(Body::from(body)) + .unwrap()) + } Err(err) => { eprintln!("{}", err); Ok(Response::builder()