Skip to content

Commit 2c99d4e

Browse files
committed
feat(header): add ContentType::form_url_encoded() constructor
1 parent e9dcf45 commit 2c99d4e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/header/common/content_type.rs

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ impl ContentType {
5353
ContentType(mime!(Text/Html; Charset=Utf8))
5454
}
5555

56+
/// A constructor to easily create a `Content-Type: application/www-form-url-encoded` header.
57+
#[inline]
58+
pub fn form_url_encoded() -> ContentType {
59+
ContentType(mime!(Application/WwwFormUrlEncoded))
60+
}
5661
/// A constructor to easily create a `Content-Type: image/jpeg` header.
5762
#[inline]
5863
pub fn jpeg() -> ContentType {
@@ -65,4 +70,5 @@ impl ContentType {
6570
ContentType(mime!(Image/Png))
6671
}
6772
}
73+
6874
bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] });

0 commit comments

Comments
 (0)