Add async-routes test for #[get] and #[catch].

This commit is contained in:
Jeb Rosen 2019-11-05 19:32:35 -08:00 committed by Sergio Benitez
parent 189fd65b17
commit 4e5b889358
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#![feature(proc_macro_hygiene)]
#[macro_use] extern crate rocket;
use rocket::http::uri::Origin;
use rocket::request::Request;
async fn noop() { }
#[get("/")]
async fn hello(_origin: &Origin<'_>) -> &'static str {
noop().await;
"Hello, world!"
}
#[catch(404)]
async fn not_found(req: &Request<'_>) -> String {
noop().await;
format!("{} not found", req.uri())
}