1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-30 00:14:58 +02:00

remove responsebody indirection from response (#2201)

This commit is contained in:
Rob Ede
2021-05-09 20:12:48 +01:00
committed by GitHub
parent a9dc1586a0
commit 900c9e270e
31 changed files with 381 additions and 263 deletions

View File

@ -32,7 +32,7 @@ use rand::{distributions::Alphanumeric, Rng};
use actix_web::dev::BodyEncoding;
use actix_web::middleware::{Compress, NormalizePath, TrailingSlash};
use actix_web::{dev, web, App, Error, HttpResponse};
use actix_web::{web, App, Error, HttpResponse};
const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
Hello World Hello World Hello World Hello World Hello World \
@ -160,9 +160,7 @@ async fn test_body_gzip2() {
let srv = actix_test::start_with(actix_test::config().h1(), || {
App::new()
.wrap(Compress::new(ContentEncoding::Gzip))
.service(web::resource("/").route(web::to(|| {
HttpResponse::Ok().body(STR).into_body::<dev::Body>()
})))
.service(web::resource("/").route(web::to(|| HttpResponse::Ok().body(STR))))
});
let mut response = srv
@ -903,7 +901,7 @@ async fn test_normalize() {
let srv = actix_test::start_with(actix_test::config().h1(), || {
App::new()
.wrap(NormalizePath::new(TrailingSlash::Trim))
.service(web::resource("/one").route(web::to(|| HttpResponse::Ok().finish())))
.service(web::resource("/one").route(web::to(|| HttpResponse::Ok())))
});
let response = srv.get("/one/").send().await.unwrap();