aboutsummaryrefslogtreecommitdiff
path: root/src/response.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/response.rs')
-rw-r--r--src/response.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/response.rs b/src/response.rs
index c7dbf88..d89dbf2 100644
--- a/src/response.rs
+++ b/src/response.rs
@@ -16,10 +16,11 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-pub enum Response {
+pub enum Response<'a> {
Input(String),
SensitiveInput(String),
Success(String),
+ SuccessFile(&'a [u8]),
TemporaryRedirect(String),
PermanentRedirect(String),
TemporaryFailure(String),
@@ -38,7 +39,7 @@ pub enum Response {
}
pub(crate) fn to_value_set_status(
- response: Response,
+ response: Response<'_>,
status: &mut i32,
) -> String {
match response {
@@ -57,6 +58,11 @@ pub(crate) fn to_value_set_status(
value
}
+ Response::SuccessFile(value) => {
+ *status = 21; // Internal status code, not real.
+
+ String::from_utf8(value.to_vec()).unwrap()
+ }
Response::TemporaryRedirect(value) => {
*status = 30;