Expand description
Contains types that set the status code and corresponding headers of a response.
§Responding
Types in this module designed to make it easier to construct correct responses with a given status code. Each type takes in the minimum number of parameters required to construct a correct response. Some types take in responders; when they do, the responder finalizes the response by writing out additional headers and, importantly, the body of the response.
The Custom
type allows responding with any Status
but does not
ensure that all of the required headers are present. As a convenience,
(Status, R)
where R: Responder
is also a Responder
, identical to
Custom
.
use rocket::http::Status;
#[get("/")]
fn index() -> (Status, &'static str) {
(Status::NotFound, "Hey, there's no index!")
}
Structs§
- Sets the status of the response to 202 Accepted (
Status::Accepted
). - Sets the status of the response to 400 Bad Request (
Status::BadRequest
). - Sets the status of the response to 409 Conflict (
Status::Conflict
). - Sets the status of the response to 201 Created.
- Creates a response with a status code and underlying responder.
- Sets the status of the response to 403 Forbidden (
Status::Forbidden
). - Sets the status of the response to 204 No Content.
- Sets the status of the response to 404 NotFound (
Status::NotFound
). - Sets the status of the response to 401 Unauthorized (
Status::Unauthorized
).