Skip to content

Commit 896c9f9

Browse files
authored
Merge pull request #114 from nandos/master
Add missing codes 423, 424, 507, 508 to StatusCode
2 parents f1d7d63 + 1c69a59 commit 896c9f9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/status_code.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,16 @@ pub enum StatusCode {
265265
/// The request was well-formed but was unable to be followed due to semantic errors.
266266
UnprocessableEntity = 422,
267267

268+
/// 423 Locked
269+
///
270+
/// The resource that is being accessed is locked.
271+
Locked = 423,
272+
273+
/// 424 Failed Dependency
274+
///
275+
/// The request failed because it depended on another request and that request failed (e.g., a PROPPATCH).
276+
FailedDependency = 424,
277+
268278
/// 425 Too Early
269279
///
270280
/// Indicates that the server is unwilling to risk processing a request that might be replayed.
@@ -349,6 +359,16 @@ pub enum StatusCode {
349359
/// point in the negotiation process.
350360
VariantAlsoNegotiates = 506,
351361

362+
/// 507 Insufficient Storage
363+
///
364+
/// The server is unable to store the representation needed to complete the request.
365+
InsufficientStorage = 507,
366+
367+
/// 508 Loop Detected
368+
///
369+
/// The server detected an infinite loop while processing the request.
370+
LoopDetected = 508,
371+
352372
/// 510 Not Extended
353373
///
354374
/// Further extensions to the request are required for the server to fulfil it.
@@ -447,6 +467,8 @@ impl StatusCode {
447467
StatusCode::ImATeapot => "I'm a teapot",
448468
StatusCode::MisdirectedRequest => "Misdirected Request",
449469
StatusCode::UnprocessableEntity => "Unprocessable Entity",
470+
StatusCode::Locked => "Locked",
471+
StatusCode::FailedDependency => "Failed Dependency",
450472
StatusCode::TooEarly => "Too Early",
451473
StatusCode::UpgradeRequired => "Upgrade Required",
452474
StatusCode::PreconditionRequired => "Precondition Required",
@@ -460,6 +482,8 @@ impl StatusCode {
460482
StatusCode::GatewayTimeout => "Gateway Timeout",
461483
StatusCode::HttpVersionNotSupported => "HTTP Version Not Supported",
462484
StatusCode::VariantAlsoNegotiates => "Variant Also Negotiates",
485+
StatusCode::InsufficientStorage => "Insufficient Storage",
486+
StatusCode::LoopDetected => "Loop Detected",
463487
StatusCode::NotExtended => "Not Extended",
464488
StatusCode::NetworkAuthenticationRequired => "Network Authentication Required",
465489
}
@@ -516,6 +540,8 @@ impl std::convert::TryFrom<u16> for StatusCode {
516540
418 => Ok(StatusCode::ImATeapot),
517541
421 => Ok(StatusCode::MisdirectedRequest),
518542
422 => Ok(StatusCode::UnprocessableEntity),
543+
423 => Ok(StatusCode::Locked),
544+
424 => Ok(StatusCode::FailedDependency),
519545
425 => Ok(StatusCode::TooEarly),
520546
426 => Ok(StatusCode::UpgradeRequired),
521547
428 => Ok(StatusCode::PreconditionRequired),
@@ -529,6 +555,8 @@ impl std::convert::TryFrom<u16> for StatusCode {
529555
504 => Ok(StatusCode::GatewayTimeout),
530556
505 => Ok(StatusCode::HttpVersionNotSupported),
531557
506 => Ok(StatusCode::VariantAlsoNegotiates),
558+
507 => Ok(StatusCode::InsufficientStorage),
559+
508 => Ok(StatusCode::LoopDetected),
532560
510 => Ok(StatusCode::NotExtended),
533561
511 => Ok(StatusCode::NetworkAuthenticationRequired),
534562
_ => crate::bail!("Invalid status code"),

0 commit comments

Comments
 (0)