mirror of https://github.com/rwf2/Rocket.git
Add async-routes test for #[get] and #[catch].
This commit is contained in:
parent
189fd65b17
commit
4e5b889358
|
@ -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())
|
||||
}
|
Loading…
Reference in New Issue