From 2c99d4e9068b30ecb6d4eac4d364924fb253fdcd Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Sat, 16 May 2015 15:08:42 -0700 Subject: [PATCH] feat(header): add ContentType::form_url_encoded() constructor --- src/header/common/content_type.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/header/common/content_type.rs b/src/header/common/content_type.rs index b8e6743d21..a7526bdf6e 100644 --- a/src/header/common/content_type.rs +++ b/src/header/common/content_type.rs @@ -53,6 +53,11 @@ impl ContentType { 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. #[inline] pub fn jpeg() -> ContentType { @@ -65,4 +70,5 @@ impl ContentType { ContentType(mime!(Image/Png)) } } + bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] });