From 299f53da9ee08c8b326bd913c5911a234e50726d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 27 Mar 2022 04:20:30 +0000 Subject: feat(response): add remaining responses (redirect) --- src/lib.rs | 1 - src/response.rs | 12 ++++++++++++ src/status.rs | 39 --------------------------------------- 3 files changed, 12 insertions(+), 40 deletions(-) delete mode 100644 src/status.rs (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index cb28717..4c8cffd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,7 +30,6 @@ pub mod response; pub(crate) mod returnable; -pub mod status; pub mod utilities; #[macro_use] diff --git a/src/response.rs b/src/response.rs index 239f8da..c7dbf88 100644 --- a/src/response.rs +++ b/src/response.rs @@ -20,6 +20,8 @@ pub enum Response { Input(String), SensitiveInput(String), Success(String), + TemporaryRedirect(String), + PermanentRedirect(String), TemporaryFailure(String), ServerUnavailable(String), CGIError(String), @@ -55,6 +57,16 @@ pub(crate) fn to_value_set_status( value } + Response::TemporaryRedirect(value) => { + *status = 30; + + value + } + Response::PermanentRedirect(value) => { + *status = 31; + + value + } Response::TemporaryFailure(value) => { *status = 40; diff --git a/src/status.rs b/src/status.rs deleted file mode 100644 index 0ba4c5b..0000000 --- a/src/status.rs +++ /dev/null @@ -1,39 +0,0 @@ -// This file is part of Windmark . -// Copyright (C) 2022-2022 Fuwn -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// Copyright (C) 2022-2022 Fuwn -// SPDX-License-Identifier: GPL-3.0-only - -#[derive(Copy, Clone)] -pub enum Code { - Input = 10, - SensitiveInput = 11, - Success = 20, - TemporaryRedirect = 30, - PermanentRedirect = 31, - TemporaryFailure = 40, - ServerUnavailable = 41, - CGIError = 42, - ProxyError = 43, - SlowDown = 44, - PermanentFailure = 50, - NotFound = 51, - Gone = 52, - ProxyRefused = 53, - BadRequest = 59, - ClientCertificateRequired = 60, - CertificateNotAuthorised = 61, - CertificateNotValid = 62, -} -- cgit v1.2.3