1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

Fix AcceptEncoding header (#2501)

This commit is contained in:
Rob Ede
2022-01-03 13:17:57 +00:00
committed by GitHub
parent b708924590
commit e890307091
33 changed files with 1360 additions and 889 deletions

View File

@ -473,7 +473,7 @@ async fn test_no_decompress() {
.wrap(actix_web::middleware::Compress::default())
.service(web::resource("/").route(web::to(|| {
let mut res = HttpResponse::Ok().body(STR);
res.encoding(header::ContentEncoding::Gzip);
res.encode_with(header::ContentEncoding::Gzip);
res
})))
});
@ -644,7 +644,9 @@ async fn test_client_brotli_encoding_large_random() {
async fn test_client_deflate_encoding() {
let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: Bytes| {
HttpResponse::Ok().encoding(ContentEncoding::Br).body(body)
HttpResponse::Ok()
.encode_with(ContentEncoding::Brotli)
.body(body)
}))
});
@ -667,7 +669,9 @@ async fn test_client_deflate_encoding_large_random() {
let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: Bytes| {
HttpResponse::Ok().encoding(ContentEncoding::Br).body(body)
HttpResponse::Ok()
.encode_with(ContentEncoding::Brotli)
.body(body)
}))
});
@ -685,7 +689,7 @@ async fn test_client_streaming_explicit() {
let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: web::Payload| {
HttpResponse::Ok()
.encoding(ContentEncoding::Identity)
.encode_with(ContentEncoding::Identity)
.streaming(body)
}))
});
@ -710,7 +714,7 @@ async fn test_body_streaming_implicit() {
});
HttpResponse::Ok()
.encoding(ContentEncoding::Gzip)
.encode_with(ContentEncoding::Gzip)
.streaming(Box::pin(body))
}))
});