Skip to content

Commit bd8896a

Browse files
authored
Treat XML MIME type responses as text (#532)
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 <[email protected]> Signed-off-by: David Calavera <[email protected]>
1 parent b1c5dfd commit bd8896a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lambda-http/src/response.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,13 @@ where
188188
return convert_to_text(self, "utf-8");
189189
};
190190

191+
// See list of common MIME types:
192+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
191193
if content_type.starts_with("text")
192194
|| content_type.starts_with("application/json")
193195
|| content_type.starts_with("application/javascript")
194196
|| content_type.starts_with("application/xml")
197+
|| content_type.ends_with("+xml")
195198
{
196199
return convert_to_text(self, content_type);
197200
}

0 commit comments

Comments
 (0)