mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 18:37:41 +02:00
disable brotli if feature is not enabled, faster compression
This commit is contained in:
@ -894,9 +894,16 @@ mod tests {
|
||||
let resp = HttpResponse::build(StatusCode::OK).finish().unwrap();
|
||||
assert_eq!(resp.content_encoding(), None);
|
||||
|
||||
#[cfg(feature="brotli")]
|
||||
{
|
||||
let resp = HttpResponse::build(StatusCode::OK)
|
||||
.content_encoding(ContentEncoding::Br).finish().unwrap();
|
||||
assert_eq!(resp.content_encoding(), Some(ContentEncoding::Br));
|
||||
}
|
||||
|
||||
let resp = HttpResponse::build(StatusCode::OK)
|
||||
.content_encoding(ContentEncoding::Br).finish().unwrap();
|
||||
assert_eq!(resp.content_encoding(), Some(ContentEncoding::Br));
|
||||
.content_encoding(ContentEncoding::Gzip).finish().unwrap();
|
||||
assert_eq!(resp.content_encoding(), Some(ContentEncoding::Gzip));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -418,12 +418,12 @@ impl ContentEncoder {
|
||||
let transfer = TransferEncoding::eof(tmp.clone());
|
||||
let mut enc = match encoding {
|
||||
ContentEncoding::Deflate => ContentEncoder::Deflate(
|
||||
DeflateEncoder::new(transfer, Compression::default())),
|
||||
DeflateEncoder::new(transfer, Compression::fast())),
|
||||
ContentEncoding::Gzip => ContentEncoder::Gzip(
|
||||
GzEncoder::new(transfer, Compression::default())),
|
||||
GzEncoder::new(transfer, Compression::fasr())),
|
||||
#[cfg(feature="brotli")]
|
||||
ContentEncoding::Br => ContentEncoder::Br(
|
||||
BrotliEncoder::new(transfer, 5)),
|
||||
BrotliEncoder::new(transfer, 3)),
|
||||
ContentEncoding::Identity => ContentEncoder::Identity(transfer),
|
||||
ContentEncoding::Auto => unreachable!()
|
||||
};
|
||||
|
Reference in New Issue
Block a user