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

This commit is contained in:
Sean McArthur
2015-05-16 15:08:42 -07:00
parent e9dcf45df3
commit 2c99d4e906

View File

@@ -53,6 +53,11 @@ impl ContentType {
ContentType(mime!(Text/Html; Charset=Utf8)) ContentType(mime!(Text/Html; Charset=Utf8))
} }
/// A constructor to easily create a `Content-Type: application/www-form-url-encoded` header.
#[inline]
pub fn form_url_encoded() -> ContentType {
ContentType(mime!(Application/WwwFormUrlEncoded))
}
/// A constructor to easily create a `Content-Type: image/jpeg` header. /// A constructor to easily create a `Content-Type: image/jpeg` header.
#[inline] #[inline]
pub fn jpeg() -> ContentType { pub fn jpeg() -> ContentType {
@@ -65,4 +70,5 @@ impl ContentType {
ContentType(mime!(Image/Png)) ContentType(mime!(Image/Png))
} }
} }
bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] }); bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] });