From f3bbcd23546bfffda1c7bc2ef963db977fe072fb Mon Sep 17 00:00:00 2001 From: Stepan Rabotkin Date: Mon, 27 Jul 2026 16:58:16 +0300 Subject: [PATCH] feat: add support for the 409 Conflict status code Add a Conflict variant to the StatusCode enum so that responses can report the 409 status code, and map it to its raw representation. Signed-off-by: Stepan Rabotkin --- src/response.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/response.rs b/src/response.rs index 718e119..9ec3dd9 100644 --- a/src/response.rs +++ b/src/response.rs @@ -30,6 +30,8 @@ pub enum StatusCode { NotFound, /// 405, Method Not Allowed MethodNotAllowed, + /// 409, Conflict + Conflict, /// 413, Payload Too Large PayloadTooLarge, /// 429, Too Many Requests @@ -53,6 +55,7 @@ impl StatusCode { Self::Unauthorized => b"401", Self::NotFound => b"404", Self::MethodNotAllowed => b"405", + Self::Conflict => b"409", Self::PayloadTooLarge => b"413", Self::TooManyRequests => b"429", Self::InternalServerError => b"500", @@ -500,6 +503,7 @@ mod tests { assert_eq!(StatusCode::Unauthorized.raw(), b"401"); assert_eq!(StatusCode::NotFound.raw(), b"404"); assert_eq!(StatusCode::MethodNotAllowed.raw(), b"405"); + assert_eq!(StatusCode::Conflict.raw(), b"409"); assert_eq!(StatusCode::PayloadTooLarge.raw(), b"413"); assert_eq!(StatusCode::TooManyRequests.raw(), b"429"); assert_eq!(StatusCode::InternalServerError.raw(), b"500");