mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-29 12:52:05 +00:00
Add async-routes test for #[get] and #[catch].
This commit is contained in:
parent
189fd65b17
commit
4e5b889358
19
core/codegen/tests/async-routes.rs
Normal file
19
core/codegen/tests/async-routes.rs
Normal 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())
|
||||
}
|
Loading…
Reference in New Issue
Block a user