Skip to content

Commit e8f5555

Browse files
jebrosenSergioBenitez
authored andcommitted
Add async-routes test for #[get] and #[catch].
1 parent eceb6cf commit e8f5555

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

core/codegen/tests/async-routes.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(proc_macro_hygiene)]
2+
3+
#[macro_use] extern crate rocket;
4+
use rocket::http::uri::Origin;
5+
use rocket::request::Request;
6+
7+
async fn noop() { }
8+
9+
#[get("/")]
10+
async fn hello(_origin: &Origin<'_>) -> &'static str {
11+
noop().await;
12+
"Hello, world!"
13+
}
14+
15+
#[catch(404)]
16+
async fn not_found(req: &Request<'_>) -> String {
17+
noop().await;
18+
format!("{} not found", req.uri())
19+
}

0 commit comments

Comments
 (0)