From c8650a696b310d3a75dd094c4eca5a9e5b4d7253 Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Sun, 22 Dec 2024 20:32:17 +0100 Subject: [PATCH] add html_utf8 to content_type.rs --- src/common/content_type.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/common/content_type.rs b/src/common/content_type.rs index a47d9e03..2ae5dffc 100644 --- a/src/common/content_type.rs +++ b/src/common/content_type.rs @@ -48,48 +48,54 @@ impl ContentType { ContentType(mime::APPLICATION_JSON) } - /// A constructor to easily create a `Content-Type: text/plain` header. + /// A constructor to easily create a `Content-Type: text/plain` header. #[inline] pub fn text() -> ContentType { ContentType(mime::TEXT_PLAIN) } - /// A constructor to easily create a `Content-Type: text/plain; charset=utf-8` header. + /// A constructor to easily create a `Content-Type: text/plain; charset=utf-8` header. #[inline] pub fn text_utf8() -> ContentType { ContentType(mime::TEXT_PLAIN_UTF_8) } - /// A constructor to easily create a `Content-Type: text/html` header. + /// A constructor to easily create a `Content-Type: text/html` header. #[inline] pub fn html() -> ContentType { ContentType(mime::TEXT_HTML) } - /// A constructor to easily create a `Content-Type: text/xml` header. + /// A constructor to easily create a `Content-Type: text/html; charset=utf-8` header. + #[inline] + pub fn html_utf8() -> ContentType { + ContentType(mime::TEXT_HTML_UTF_8) + } + + /// A constructor to easily create a `Content-Type: text/xml` header. #[inline] pub fn xml() -> ContentType { ContentType(mime::TEXT_XML) } - /// A constructor to easily create a `Content-Type: application/www-form-url-encoded` header. + /// A constructor to easily create a `Content-Type: application/www-form-url-encoded` header. #[inline] pub fn form_url_encoded() -> ContentType { ContentType(mime::APPLICATION_WWW_FORM_URLENCODED) } - /// A constructor to easily create a `Content-Type: image/jpeg` header. + /// A constructor to easily create a `Content-Type: image/jpeg` header. #[inline] pub fn jpeg() -> ContentType { ContentType(mime::IMAGE_JPEG) } - /// A constructor to easily create a `Content-Type: image/png` header. + /// A constructor to easily create a `Content-Type: image/png` header. #[inline] pub fn png() -> ContentType { ContentType(mime::IMAGE_PNG) } - /// A constructor to easily create a `Content-Type: application/octet-stream` header. + /// A constructor to easily create a `Content-Type: application/octet-stream` header. #[inline] pub fn octet_stream() -> ContentType { ContentType(mime::APPLICATION_OCTET_STREAM)