response
ModuleThe outgoing response: status, headers and cookies set by the
application, sent once through Response::send (or streamed with
Response::chunk); what reaches the connection is recorded as a
Wire.
Contents
2 submodules, and what the module defines itself.
use utopia_http::Cookie;pub struct CookieA cookie added with Response::add_cookie. None means not given.
use utopia_http::Response;pub struct ResponseAn outgoing response.
The application sets the status, headers and cookies, then sends the body once (or in chunks); later sends are ignored.
Clone, Default.use utopia_http::Wire;pub struct WireThe response on the wire: the status, headers, cookies and body bytes the response has sent so far.
use utopia_http::reason;pub fn reason(code: u16) -> Option<&'static str>The reason phrase of a status code, or None for a code the response
does not accept.
pub type Body = http_body_util::combinators::BoxBody<Bytes, std::convert::Infallible>A hyper response body: a buffer, or the frames a streamed response sends.
pub const CHARSET_UTF8: &str = "UTF-8"The UTF-8 charset name, for Response::set_content_type.
pub const CHUNK_SIZE: usize = 2_000_000Bodies larger than this many bytes are written in chunks.
response::content_type
Own pageCommon content types.
pub const HTML: &str = "text/html"text/html.
pub const IMAGE: &str = "image/*"image/*: any image.
pub const IMAGE_BMP: &str = "image/bmp"image/bmp.
pub const IMAGE_GIF: &str = "image/gif"image/gif.
pub const IMAGE_ICON: &str = "image/x-icon"image/x-icon.
pub const IMAGE_JPEG: &str = "image/jpeg"image/jpeg.
pub const IMAGE_PNG: &str = "image/png"image/png.
pub const IMAGE_SVG: &str = "image/svg+xml"image/svg+xml.
pub const IMAGE_WEBP: &str = "image/webp"image/webp.
pub const JAVASCRIPT: &str = "text/javascript"text/javascript.
pub const JSON: &str = "application/json"application/json.
pub const TEXT: &str = "text/plain"text/plain.
pub const XML: &str = "text/xml"text/xml.
response::same_site
Own pageThe SameSite values of a cookie.
pub const LAX: &str = "Lax"Lax: sent with same-site requests and top-level navigations.
pub const NONE: &str = "None"None: sent with cross-site requests.
pub const STRICT: &str = "Strict"Strict: sent with same-site requests only.