diff options
author | Martin Fischer <martin@push-f.com> | 2021-07-03 20:52:13 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-07-03 21:14:36 +0200 |
commit | 17d98a70a76efc02f643e9cfe13836120a2c5114 (patch) | |
tree | fc86587c7444304c70313a6b8fc289d83cfb8a0f /src/main.rs | |
parent | 973acc037b2a78b1ad3d2ccb0c1dd38098335269 (diff) |
refactor: introduce build_raw_response helper
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 58431a2..d3c88f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ use serde::Deserialize; use sputnik::html_escape; use sputnik::mime; use sputnik::request::SputnikParts; +use sputnik::response::EmptyBuilder; use sputnik::response::SputnikBuilder; use std::convert::Infallible; use std::env; @@ -241,6 +242,12 @@ async fn service<C: Controller>( Error::Forbidden(msg) => (403, msg), Error::NotFound(msg) => (404, msg), Error::Internal(msg) => (500, msg), + Error::NotModified => { + return Builder::new() + .status(StatusCode::NOT_MODIFIED) + .empty() + .unwrap(); + } Error::MissingTrailingSlash(path) => { return Builder::new() .status(StatusCode::FOUND) |