Skip to content

Commit c1a38b5

Browse files
luminitavoicudianpopa
authored andcommitted
response: add Unauthorized status code
Signed-off-by: Luminita Voicu <[email protected]>
1 parent 9517a30 commit c1a38b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/response.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub enum StatusCode {
2222
NoContent,
2323
/// 400, Bad Request
2424
BadRequest,
25+
/// 401, Unauthorized
26+
Unauthorized,
2527
/// 404, Not Found
2628
NotFound,
2729
/// 405, Method Not Allowed
@@ -42,6 +44,7 @@ impl StatusCode {
4244
Self::OK => b"200",
4345
Self::NoContent => b"204",
4446
Self::BadRequest => b"400",
47+
Self::Unauthorized => b"401",
4548
Self::NotFound => b"404",
4649
Self::MethodNotAllowed => b"405",
4750
Self::InternalServerError => b"500",
@@ -369,6 +372,7 @@ mod tests {
369372
assert_eq!(StatusCode::OK.raw(), b"200");
370373
assert_eq!(StatusCode::NoContent.raw(), b"204");
371374
assert_eq!(StatusCode::BadRequest.raw(), b"400");
375+
assert_eq!(StatusCode::Unauthorized.raw(), b"401");
372376
assert_eq!(StatusCode::NotFound.raw(), b"404");
373377
assert_eq!(StatusCode::MethodNotAllowed.raw(), b"405");
374378
assert_eq!(StatusCode::InternalServerError.raw(), b"500");

0 commit comments

Comments
 (0)