From 46932e7d5664c97ad65aefc3f670f7e64e6f8e0d Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Fri, 8 Mar 2019 23:57:05 +0100 Subject: Improved HTTP headers --- src/archive.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/archive.rs') diff --git a/src/archive.rs b/src/archive.rs index 0f09005..1b31d08 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -1,3 +1,4 @@ +use actix_web::http::ContentEncoding; use bytes::Bytes; use libflate::gzip::Encoder; use serde::Deserialize; @@ -29,6 +30,19 @@ impl CompressionMethod { } .to_string() } + + pub fn content_type(&self) -> String { + match &self { + CompressionMethod::TarGz => "application/gzip", + } + .to_string() + } + + pub fn content_encoding(&self) -> ContentEncoding { + match &self { + CompressionMethod::TarGz => ContentEncoding::Gzip, + } + } } /// Possible errors -- cgit v1.2.3