mirror of
https://github.com/lune-org/lune.git
synced 2025-05-04 10:43:57 +01:00
Dont iterate all headers to find just content encoding
This commit is contained in:
parent
03c013cc3c
commit
bc87d6ca2f
1 changed files with 2 additions and 6 deletions
|
@ -30,12 +30,8 @@ pub async fn handle_incoming_body(
|
||||||
|
|
||||||
let was_decompressed = if should_decompress {
|
let was_decompressed = if should_decompress {
|
||||||
let decompress_format = headers
|
let decompress_format = headers
|
||||||
.iter()
|
.get(CONTENT_ENCODING)
|
||||||
.find(|(name, _)| {
|
.and_then(|value| value.to_str().ok())
|
||||||
name.as_str()
|
|
||||||
.eq_ignore_ascii_case(CONTENT_ENCODING.as_str())
|
|
||||||
})
|
|
||||||
.and_then(|(_, value)| value.to_str().ok())
|
|
||||||
.and_then(CompressDecompressFormat::detect_from_header_str);
|
.and_then(CompressDecompressFormat::detect_from_header_str);
|
||||||
if let Some(format) = decompress_format {
|
if let Some(format) = decompress_format {
|
||||||
body = decompress(body, format).await?;
|
body = decompress(body, format).await?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue