Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
An example Tide unit test in Rust, with a Request and checked Response
mod tests {
async fn index_page() -> tide::Result<()> {
use tide::http::{Url, Method, Request, Response};
let mut app = tide::new();"/").get(|_| async { Ok("Hello, world!") });
let url = Url::parse("").unwrap();
let req = Request::new(Method::Get, url);
let mut res: Response = app.respond(req).await?;
assert_eq!("Hello, world", res.body_string().await?);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment