aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorboastful-squirrel <boastful.squirrel@gmail.com>2019-05-01 16:23:29 +0000
committerboastful-squirrel <boastful.squirrel@gmail.com>2019-05-01 16:23:29 +0000
commitfa0c2865366b1bb65a2977c4b9608c9a92fc5889 (patch)
treeefdaab480316866824abbf7557458cb877db2993 /src/main.rs
parentFix return link when random_route is set (diff)
downloadminiserve-fa0c2865366b1bb65a2977c4b9608c9a92fc5889.tar.gz
miniserve-fa0c2865366b1bb65a2977c4b9608c9a92fc5889.zip
Use HTTP StatusCode for error title
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index f0c23cc..46f22c5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,6 @@
#![feature(proc_macro_hygiene)]
-use actix_web::http::Method;
+use actix_web::http::{Method, StatusCode};
use actix_web::{fs, middleware, server, App, HttpRequest, HttpResponse};
use clap::crate_version;
use simplelog::{Config, LevelFilter, TermLogger};
@@ -284,7 +284,7 @@ fn p404(req: &HttpRequest<crate::MiniserveConfig>) -> Result<HttpResponse, io::E
let default_color_scheme = req.state().default_color_scheme;
let return_address = match &req.state().random_route {
Some(random_route) => format!("/{}", random_route),
- None => req.path().to_string(),
+ None => "/".to_string(),
};
errors::log_error_chain(err_404.to_string());
@@ -292,6 +292,7 @@ fn p404(req: &HttpRequest<crate::MiniserveConfig>) -> Result<HttpResponse, io::E
Ok(actix_web::HttpResponse::NotFound().body(
renderer::render_error(
&err_404.to_string(),
+ StatusCode::NOT_FOUND,
&return_address,
None,
None,