From f7fe7100c38c052a4d4c5dd2e7a44f498ea4f831 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Sat, 17 Sep 2022 11:49:32 -0700 Subject: [PATCH] Treat XML MIME type responses as text Files with the following MIME types are xml files: application/vnd.apple.installer+xml image/svg+xml application/xhtml+xml application/vnd.mozilla.xul+xml application/atom+xml Signed-off-by: David Calavera --- lambda-http/src/response.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lambda-http/src/response.rs b/lambda-http/src/response.rs index adfe3528..299a60b2 100644 --- a/lambda-http/src/response.rs +++ b/lambda-http/src/response.rs @@ -188,10 +188,13 @@ where return convert_to_text(self, "utf-8"); }; + // See list of common MIME types: + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types if content_type.starts_with("text") || content_type.starts_with("application/json") || content_type.starts_with("application/javascript") || content_type.starts_with("application/xml") + || content_type.ends_with("+xml") { return convert_to_text(self, content_type); }