relay_server/middlewares/
decompression.rsuse axum::extract::Request;
use axum::http::header;
pub use tower_http::decompression::RequestDecompressionLayer;
pub fn remove_empty_encoding(mut request: Request) -> Request {
if let header::Entry::Occupied(entry) = request.headers_mut().entry(header::CONTENT_ENCODING) {
if should_ignore_encoding(entry.get().as_bytes()) {
entry.remove();
}
}
request
}
fn should_ignore_encoding(value: &[u8]) -> bool {
value == b"" || value.eq_ignore_ascii_case(b"utf-8")
}