diff options
Diffstat (limited to 'src/controller')
-rw-r--r-- | src/controller/utils.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/controller/utils.rs b/src/controller/utils.rs index 225f8a4..544cdf8 100644 --- a/src/controller/utils.rs +++ b/src/controller/utils.rs @@ -96,6 +96,18 @@ pub fn template( ) } +pub fn text(str: String) -> Response<Body> { + let mut response = Response::new(str.into()); + *response.status_mut() = StatusCode::OK; + response +} + +pub fn ok() -> Response<Body> { + let mut response = Response::default(); + *response.status_mut() = StatusCode::OK; + response +} + pub fn redirect(uri: &str) -> Response<Body> { let mut response = Response::default(); *response.status_mut() = StatusCode::MOVED_PERMANENTLY; |