mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 05:21:14 +00:00
19 lines
397 B
Rust
19 lines
397 B
Rust
use rinja_warp::Template;
|
|
use warp::Filter;
|
|
|
|
#[derive(Template)]
|
|
#[template(path = "hello.html")]
|
|
struct HelloTemplate<'a> {
|
|
name: &'a str,
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_warp() {
|
|
let filter = warp::get().map(|| HelloTemplate { name: "world" });
|
|
|
|
let res = warp::test::request().reply(&filter).await;
|
|
|
|
assert_eq!(res.status(), 200);
|
|
assert_eq!(res.body(), "Hello, world!");
|
|
}
|