1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-30 16:40:21 +02:00

introduce RouteData extractor

This commit is contained in:
Nikolay Kim
2019-03-16 21:09:11 -07:00
parent 6afcecdb5f
commit 60386f1791
9 changed files with 198 additions and 37 deletions

View File

@@ -487,26 +487,6 @@ mod tests {
assert_eq!(resp.status(), StatusCode::CREATED);
}
#[test]
fn test_data() {
let mut srv =
init_service(App::new().data(10usize).service(
web::resource("/").to(|_: web::Data<usize>| HttpResponse::Ok()),
));
let req = TestRequest::default().to_request();
let resp = block_on(srv.call(req)).unwrap();
assert_eq!(resp.status(), StatusCode::OK);
let mut srv =
init_service(App::new().data(10u32).service(
web::resource("/").to(|_: web::Data<usize>| HttpResponse::Ok()),
));
let req = TestRequest::default().to_request();
let resp = block_on(srv.call(req)).unwrap();
assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR);
}
#[test]
fn test_data_factory() {
let mut srv =