pub type Response<T = Body> = Response<T>;Expand description
Represents an HTTP Response.
Aliased Type§
pub struct Response<T = Body> { /* private fields */ }Trait Implementations§
Source§impl IntoResponse for Response
impl IntoResponse for Response
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert self to HTTP
Response.Source§fn into_error(self) -> Error
fn into_error(self) -> Error
Convert self to the
Error.Source§impl ResponseExt for Response
impl ResponseExt for Response
Source§fn content_length(&self) -> Option<u64>
fn content_length(&self) -> Option<u64>
Get the size of this response’s body.
Source§fn content_type(&self) -> Option<Mime>
fn content_type(&self) -> Option<Mime>
Get the media type of this response.
Source§fn header<K, T>(&self, key: K) -> Option<T>where
K: AsHeaderName,
T: FromStr,
fn header<K, T>(&self, key: K) -> Option<T>where
K: AsHeaderName,
T: FromStr,
Get a header with the key.
Source§async fn download<T>(path: T, name: Option<&str>) -> Result<Self>
async fn download<T>(path: T, name: Option<&str>) -> Result<Self>
Available on crate feature
fs only.Downloads transfers the file from path as an attachment.
Source§fn with<B>(body: B, content_type: &str) -> Response
fn with<B>(body: B, content_type: &str) -> Response
The response with the specified
Content-Type.Source§fn json<T>(body: T) -> Result<Response, PayloadError>where
T: Serialize,
fn json<T>(body: T) -> Result<Response, PayloadError>where
T: Serialize,
Available on crate feature
json only.The response with
application/javascript; charset=utf-8 media type. Read moreSource§fn attachment(value: &str) -> Response
fn attachment(value: &str) -> Response
The
Content-Disposition header indicates if the content is expected to be
displayed inline in the browser, that is, as a Web page or as part of a Web page,
or as an attachment, that is downloaded and saved locally.Source§fn location<T>(location: T) -> Response
fn location<T>(location: T) -> Response
The
Content-Location header indicates an alternate location for the returned data.Source§fn redirect_with_status<T>(url: T, status: StatusCode) -> Response
fn redirect_with_status<T>(url: T, status: StatusCode) -> Response
The response redirects to the specified URL and the status code.