mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
Add html_utf8
content type. (#2423)
This commit is contained in:
parent
d13854505f
commit
855e260fdb
@ -1,6 +1,8 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
### Changed
|
||||||
|
* `ContentType::html` now returns `Content-Type: text/html; charset=utf-8` instead of `Content-Type: text/html`.
|
||||||
|
|
||||||
|
|
||||||
## 4.0.0-beta.10 - 2021-10-20
|
## 4.0.0-beta.10 - 2021-10-20
|
||||||
|
@ -60,52 +60,53 @@ crate::http::header::common_header! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ContentType {
|
impl ContentType {
|
||||||
/// A constructor to easily create a `Content-Type: application/json`
|
/// A constructor to easily create a `Content-Type: application/json`
|
||||||
/// header.
|
/// header.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn json() -> ContentType {
|
pub fn json() -> ContentType {
|
||||||
ContentType(mime::APPLICATION_JSON)
|
ContentType(mime::APPLICATION_JSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A constructor to easily create a `Content-Type: text/plain;
|
/// A constructor to easily create a `Content-Type: text/plain;
|
||||||
/// charset=utf-8` header.
|
/// charset=utf-8` header.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn plaintext() -> ContentType {
|
pub fn plaintext() -> ContentType {
|
||||||
ContentType(mime::TEXT_PLAIN_UTF_8)
|
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; charset=utf-8`
|
||||||
|
/// header.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn html() -> ContentType {
|
pub fn html() -> ContentType {
|
||||||
ContentType(mime::TEXT_HTML)
|
ContentType(mime::TEXT_HTML_UTF_8)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A constructor to easily create a `Content-Type: text/xml` header.
|
/// A constructor to easily create a `Content-Type: text/xml` header.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn xml() -> ContentType {
|
pub fn xml() -> ContentType {
|
||||||
ContentType(mime::TEXT_XML)
|
ContentType(mime::TEXT_XML)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A constructor to easily create a `Content-Type:
|
/// A constructor to easily create a `Content-Type:
|
||||||
/// application/www-form-url-encoded` header.
|
/// application/www-form-url-encoded` header.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn form_url_encoded() -> ContentType {
|
pub fn form_url_encoded() -> ContentType {
|
||||||
ContentType(mime::APPLICATION_WWW_FORM_URLENCODED)
|
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]
|
#[inline]
|
||||||
pub fn jpeg() -> ContentType {
|
pub fn jpeg() -> ContentType {
|
||||||
ContentType(mime::IMAGE_JPEG)
|
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]
|
#[inline]
|
||||||
pub fn png() -> ContentType {
|
pub fn png() -> ContentType {
|
||||||
ContentType(mime::IMAGE_PNG)
|
ContentType(mime::IMAGE_PNG)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A constructor to easily create a `Content-Type:
|
/// A constructor to easily create a `Content-Type:
|
||||||
/// application/octet-stream` header.
|
/// application/octet-stream` header.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn octet_stream() -> ContentType {
|
pub fn octet_stream() -> ContentType {
|
||||||
|
Loading…
Reference in New Issue
Block a user