From a1c644d80bd1d8ea69eb5d071ac73458fb575f5c Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Tue, 19 Apr 2022 23:48:17 -0400 Subject: [PATCH] feat: allow header injection for liveview --- packages/liveview/examples/warp.rs | 2 +- packages/liveview/src/lib.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/liveview/examples/warp.rs b/packages/liveview/examples/warp.rs index a02a5231a..e20f07964 100644 --- a/packages/liveview/examples/warp.rs +++ b/packages/liveview/examples/warp.rs @@ -13,7 +13,7 @@ async fn main() { // todo: compactify this routing under one liveview::app method let view = liveview::new(addr); - let body = view.body(); + let body = view.body("Dioxus LiveView"); let routes = warp::path::end() .map(move || warp::reply::html(body.clone())) diff --git a/packages/liveview/src/lib.rs b/packages/liveview/src/lib.rs index 340a3e4ea..f3ad90511 100644 --- a/packages/liveview/src/lib.rs +++ b/packages/liveview/src/lib.rs @@ -31,14 +31,13 @@ pub struct Liveview { } impl Liveview { - pub fn body(&self) -> String { + pub fn body(&self, header: &str) -> String { format!( r#" - Dioxus app - + {header}