diff --git a/src/sinks/azure_blob/integration_tests.rs b/src/sinks/azure_blob/integration_tests.rs index ec3dc5ac1d1c8..9cddbef79f949 100644 --- a/src/sinks/azure_blob/integration_tests.rs +++ b/src/sinks/azure_blob/integration_tests.rs @@ -111,7 +111,11 @@ async fn azure_blob_insert_json_into_blob() { assert_eq!(blobs.len(), 1); assert!(blobs[0].clone().ends_with(".log")); let (blob, blob_lines) = config.get_blob(blobs[0].clone()).await; - assert_eq!(blob.properties.content_type, String::from("text/plain")); + assert_eq!(blob.properties.content_encoding, None); + assert_eq!( + blob.properties.content_type, + String::from("application/x-ndjson") + ); let expected = events .iter() .map(|event| serde_json::to_string(&event.as_log().all_fields().unwrap()).unwrap()) @@ -138,10 +142,8 @@ async fn azure_blob_insert_lines_into_blob_gzip() { assert_eq!(blobs.len(), 1); assert!(blobs[0].clone().ends_with(".log.gz")); let (blob, blob_lines) = config.get_blob(blobs[0].clone()).await; - assert_eq!( - blob.properties.content_type, - String::from("application/gzip") - ); + assert_eq!(blob.properties.content_encoding, Some(String::from("gzip"))); + assert_eq!(blob.properties.content_type, String::from("text/plain")); assert_eq!(lines, blob_lines); } @@ -170,9 +172,10 @@ async fn azure_blob_insert_json_into_blob_gzip() { assert_eq!(blobs.len(), 1); assert!(blobs[0].clone().ends_with(".log.gz")); let (blob, blob_lines) = config.get_blob(blobs[0].clone()).await; + assert_eq!(blob.properties.content_encoding, Some(String::from("gzip"))); assert_eq!( blob.properties.content_type, - String::from("application/gzip") + String::from("application/x-ndjson") ); let expected = events .iter() diff --git a/src/sinks/azure_blob/request_builder.rs b/src/sinks/azure_blob/request_builder.rs index ae8f8770381a5..0ae3fb848d922 100644 --- a/src/sinks/azure_blob/request_builder.rs +++ b/src/sinks/azure_blob/request_builder.rs @@ -93,20 +93,9 @@ impl RequestBuilder<(String, Vec)> for AzureBlobRequestOptions { AzureBlobRequest { blob_data, content_encoding: self.compression.content_encoding(), - content_type: self.compression.content_type(), + content_type: self.encoder.1.content_type(), metadata: azure_metadata, request_metadata, } } } - -impl Compression { - pub const fn content_type(self) -> &'static str { - match self { - Self::None => "text/plain", - Self::Gzip(_) => "application/gzip", - Self::Zlib(_) => "application/zlib", - Self::Zstd(_) => "application/zstd", - } - } -} diff --git a/src/sinks/azure_blob/test.rs b/src/sinks/azure_blob/test.rs index 0c4ad1f38dd53..d35606ac12938 100644 --- a/src/sinks/azure_blob/test.rs +++ b/src/sinks/azure_blob/test.rs @@ -129,7 +129,7 @@ fn azure_blob_build_request_with_compression() { assert_eq!(request.metadata.partition_key, "blob.log.gz".to_string()); assert_eq!(request.content_encoding, Some("gzip")); - assert_eq!(request.content_type, "application/gzip"); + assert_eq!(request.content_type, "text/plain"); } #[test]