aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-27 04:20:30 +0000
committerFuwn <[email protected]>2022-03-27 04:20:30 +0000
commit299f53da9ee08c8b326bd913c5911a234e50726d (patch)
tree62f3a8f3b5975a88c1306a041796da12cf324458 /src
parentfeat(response): implement many more responses (diff)
downloadwindmark-299f53da9ee08c8b326bd913c5911a234e50726d.tar.xz
windmark-299f53da9ee08c8b326bd913c5911a234e50726d.zip
feat(response): add remaining responses (redirect)
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs1
-rw-r--r--src/response.rs12
-rw-r--r--src/status.rs39
3 files changed, 12 insertions, 40 deletions
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 <https://github.com/gemrest/windmark>.
-// Copyright (C) 2022-2022 Fuwn <[email protected]>
-//
-// 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 <http://www.gnu.org/licenses/>.
-//
-// Copyright (C) 2022-2022 Fuwn <[email protected]>
-// 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,
-}