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

Remove content_length from ResponseBuilder (#1491)

* Remove content_length since it'll be overwritten by the response body. FIXES #1439

* Add setting of Content-Length to the no_chunking function

* Add changes and migration documentations

* Update MIGRATION.md

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>

Co-authored-by: Rob Ede <robjtede@icloud.com>
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
This commit is contained in:
Omid Rad
2020-05-19 00:46:31 +02:00
committed by GitHub
parent 426a9b5d4d
commit 32a37b7282
7 changed files with 14 additions and 13 deletions

View File

@ -349,7 +349,7 @@ async fn test_body_br_streaming() {
async fn test_head_binary() {
let srv = test::start_with(test::config().h1(), || {
App::new().service(web::resource("/").route(
web::head().to(move || HttpResponse::Ok().content_length(100).body(STR)),
web::head().to(move || HttpResponse::Ok().body(STR)),
))
});
@ -371,8 +371,7 @@ async fn test_no_chunking() {
let srv = test::start_with(test::config().h1(), || {
App::new().service(web::resource("/").route(web::to(move || {
HttpResponse::Ok()
.no_chunking()
.content_length(STR.len() as u64)
.no_chunking(STR.len() as u64)
.streaming(TestBody::new(Bytes::from_static(STR.as_ref()), 24))
})))
});