This commit is contained in:
Ali MJ Al-Nasrawy 2021-12-22 12:54:08 +03:00
parent 242fcf1582
commit 8f8a3be189
2 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,10 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
### Changed
- no longer requires `Scope` service body type to be boxed. [#2523]
[#2523]: https://github.com/actix/actix-web/pull/2523
## 4.0.0-beta.15 - 2021-12-17 ## 4.0.0-beta.15 - 2021-12-17

View File

@ -986,9 +986,9 @@ mod tests {
); );
} }
/// Any output body type should be accepted; test for `EitherBody`
#[actix_rt::test] #[actix_rt::test]
async fn test_middleware_body_type() { async fn test_middleware_body_type() {
// Compile test that Scope accepts any body type; test for `EitherBody`
let srv = init_service( let srv = init_service(
App::new().service( App::new().service(
web::scope("app") web::scope("app")
@ -1001,13 +1001,12 @@ mod tests {
) )
.await; .await;
// test if `is_complete_body()` is preserved across scope layer // test if `MessageBody::try_into_bytes()` is preserved across scope layer
use actix_http::body::MessageBody as _; use actix_http::body::MessageBody as _;
let req = TestRequest::with_uri("/app/test").to_request(); let req = TestRequest::with_uri("/app/test").to_request();
let resp = call_service(&srv, req).await; let resp = call_service(&srv, req).await;
let mut body = resp.into_body(); let body = resp.into_body();
assert!(body.is_complete_body()); assert_eq!(body.try_into_bytes().unwrap(), b"hello".as_ref());
assert_eq!(body.take_complete_body(), b"hello".as_ref());
} }
#[actix_rt::test] #[actix_rt::test]