feat(header): add ContentType::xml() constructor

This commit is contained in:
Laurent Arnoud
2017-09-22 20:27:10 +02:00
committed by Sean McArthur
parent 77bfcd9515
commit 92595e84a2

View File

@@ -68,12 +68,18 @@ impl ContentType {
ContentType(mime::TEXT_PLAIN_UTF_8) ContentType(mime::TEXT_PLAIN_UTF_8)
} }
/// A constructor to easily create a `Content-Type: text/html; charset=utf-8` header. /// A constructor to easily create a `Content-Type: text/html` header.
#[inline] #[inline]
pub fn html() -> ContentType { pub fn html() -> ContentType {
ContentType(mime::TEXT_HTML) ContentType(mime::TEXT_HTML)
} }
/// 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] #[inline]
pub fn form_url_encoded() -> ContentType { pub fn form_url_encoded() -> ContentType {