Skip to content

Commit f7f6d78

Browse files
committed
fix the Content-Encoding header
1 parent e33a9cf commit f7f6d78

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

apollo-router/src/axum_factory/axum_http_server_factory.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,10 @@ async fn handle_graphql(
478478
let body = match opt_compressor {
479479
None => body,
480480
Some(compressor) => {
481-
parts
482-
.headers
483-
.insert(CONTENT_ENCODING, HeaderValue::from_static("deflate"));
481+
parts.headers.insert(
482+
CONTENT_ENCODING,
483+
HeaderValue::from_static(compressor.content_encoding()),
484+
);
484485
Body::wrap_stream(compressor.process(body))
485486
}
486487
};

apollo-router/src/axum_factory/compression/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ impl Compressor {
5555
None
5656
}
5757

58+
pub(crate) fn content_encoding(&self) -> &'static str {
59+
match self {
60+
Compressor::Deflate(_) => "deflate",
61+
Compressor::Gzip(_) => "gzip",
62+
Compressor::Brotli(_) => "br",
63+
Compressor::Zstd(_) => "zstd",
64+
}
65+
}
66+
5867
pub(crate) fn process(
5968
mut self,
6069
mut stream: hyper::Body,

0 commit comments

Comments
 (0)