pub enum Status {
Show 54 variants
Continue,
SwitchingProtocols,
EarlyHints,
Ok,
Created,
Accepted,
NonAuthoritativeInformation,
NoContent,
ResetContent,
PartialContent,
MultipleChoices,
MovedPermanently,
Found,
SeeOther,
NotModified,
UseProxy,
TemporaryRedirect,
PermanentRedirect,
BadRequest,
Unauthorized,
PaymentRequired,
Forbidden,
NotFound,
MethodNotAllowed,
NotAcceptable,
ProxyAuthenticationRequired,
RequestTimeOut,
Conflict,
Gone,
LengthRequired,
PreconditionFailed,
PayloadTooLarge,
URITooLarge,
UnsupportedMediaType,
RangeNotSatisfiable,
ExpectationFailed,
ImaTeapot,
MisdirectedRequest,
TooEarly,
UpgradeRequired,
PreconditionRequired,
TooManyRequests,
RequestHeaderFieldsTooLarge,
UnavailableForLegalReasons,
InternalServerError,
NotImplemented,
BadGateway,
ServiceUnavailable,
GatewayTimeOut,
HTTPVersionNotSupported,
VariantAlsoNegotiates,
NotExtended,
NetworkAuthenticationRequired,
Custom(u16),
}
Expand description
HTTP status codes.
Used in crate::Request
and crate::Response
.
Used to indicate the status of an HTTP response.
Note: Methods that accept a Status
will also accept any u16
value, converting it to a Status::Custom if it is not a valid status code.
Supports Status:
- 100-101
- 200-206
- 300-307
- 400-417
- 500-505
From https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
Variants§
Continue
HTTP 100 Continue. MDN
SwitchingProtocols
HTTP 101 Switching Protocols. MDN
EarlyHints
HTTP 103 Early Hints. MDN
Ok
HTTP 200 OK. MDN
Created
HTTP 201 Created. MDN
Accepted
HTTP 202 Accepted. MDN
NonAuthoritativeInformation
HTTP 203 Non-Authoritative Information. MDN
NoContent
HTTP 204 No Content. MDN
ResetContent
HTTP 205 Reset Content. MDN
PartialContent
HTTP 206 Partial Content. MDN
MultipleChoices
HTTP 300 Multiple Choices. MDN
MovedPermanently
HTTP 301 Moved Permanently. MDN
Found
HTTP 302 Found. MDN
SeeOther
HTTP 303 See Other. MDN
NotModified
HTTP 304 Not Modified. MDN
UseProxy
HTTP 305 Use Proxy. MDN
TemporaryRedirect
HTTP 307 Temporary Redirect. MDN
PermanentRedirect
HTTP 308 Permanent Redirect. MDN
BadRequest
HTTP 400 Bad Request. MDN
HTTP 401 Unauthorized. MDN
PaymentRequired
HTTP 402 Payment Required. MDN
Forbidden
HTTP 403 Forbidden. MDN
NotFound
HTTP 404 Not Found. MDN
MethodNotAllowed
HTTP 405 Method Not Allowed. MDN
NotAcceptable
HTTP 406 Not Acceptable. MDN
ProxyAuthenticationRequired
HTTP 407 Proxy Authentication Required. MDN
RequestTimeOut
HTTP 408 Request Time-out. MDN
Conflict
HTTP 409 Conflict. MDN
Gone
HTTP 410 Gone. MDN
LengthRequired
HTTP 411 Length Required. MDN
PreconditionFailed
HTTP 412 Precondition Failed. MDN
PayloadTooLarge
HTTP 413 Payload Too Large. MDN
URITooLarge
HTTP 414 URI Too Large. MDN
UnsupportedMediaType
HTTP 415 Unsupported Media Type. MDN
RangeNotSatisfiable
HTTP 416 Range Not Satisfiable. MDN
ExpectationFailed
HTTP 417 Expectation Failed. MDN
ImaTeapot
HTTP 418 I’m a teapot. MDN
MisdirectedRequest
HTTP 421 Misdirected Request. MDN
TooEarly
HTTP 425 Too Early. MDN
UpgradeRequired
HTTP 426 Upgrade Required. MDN
PreconditionRequired
HTTP 428 Precondition Required. MDN
TooManyRequests
HTTP 429 Too Many Requests. MDN
RequestHeaderFieldsTooLarge
HTTP 431 Request Header Fields Too Large. MDN
HTTP 451 Unavailable For Legal Reasons. MDN
InternalServerError
HTTP 500 Internal Server Error. MDN
NotImplemented
HTTP 501 Not Implemented. MDN
BadGateway
HTTP 502 Bad Gateway. MDN
HTTP 503 Service Unavailable. MDN
GatewayTimeOut
HTTP 504 Gateway Time-out. MDN
HTTPVersionNotSupported
HTTP 505 HTTP Version Not Supported. MDN
VariantAlsoNegotiates
HTTP 506 Variant Also Negotiates. MDN
NotExtended
HTTP 510 Not Extended. MDN
NetworkAuthenticationRequired
HTTP 511 Network Authentication Required. MDN
Custom(u16)
Custom status code
Implementations§
source§impl Status
impl Status
sourcepub fn reason_phrase(&self) -> &str
pub fn reason_phrase(&self) -> &str
Gets the default reason phrase for the status.
For responses you can use the crate::Response::reason
method to set a custom reason phrase.
Trait Implementations§
source§impl Ord for Status
impl Ord for Status
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<Status> for Status
impl PartialEq<Status> for Status
source§impl PartialOrd<Status> for Status
impl PartialOrd<Status> for Status
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more