Skip to content

Commit

Permalink
sync to master branch by adding test_wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
pmd3d committed Apr 17, 2024
1 parent 6d3fff2 commit 89f7819
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions actix-web-codegen/tests/test_macro.rs
Expand Up @@ -6,6 +6,7 @@ use actix_web::{
http::{
self,
header::{HeaderName, HeaderValue},
StatusCode,
},
web, App, Error, HttpRequest, HttpResponse, Responder,
};
Expand Down Expand Up @@ -371,6 +372,20 @@ async fn test_auto_async() {
assert!(response.status().is_success());
}

#[actix_web::test]
async fn test_wrap() {
let srv = actix_test::start(|| App::new().service(get_wrap));

let request = srv.request(http::Method::GET, srv.url("/test/wrap"));
let mut response = request.send().await.unwrap();
assert_eq!(response.status(), StatusCode::NOT_FOUND);
assert!(response.headers().contains_key("custom-header"));
let body = response.body().await.unwrap();
let body = String::from_utf8(body.to_vec()).unwrap();
assert!(body.contains("wrong number of parameters"));

Check warning on line 385 in actix-web-codegen/tests/test_macro.rs

View workflow job for this annotation

GitHub Actions / fmt

Diff in /home/runner/work/actix-web/actix-web/actix-web-codegen/tests/test_macro.rs
}


#[scope("/test")]
mod scope_module {
use actix_web::{delete, get, post, route, routes, web, HttpResponse, Responder};
Expand Down

0 comments on commit 89f7819

Please sign in to comment.