summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2023-12-19 06:58:20 +0100
committerache <ache@ache.one>2023-12-19 06:58:20 +0100
commit3e8da1b4419bd7f97ff593418bb7e6dd294a7760 (patch)
treeb83cc41e34d15588680259ceecba1824566ef6c8
parentChange message error when receiving bad HTTP method (diff)
Linter pass
-rw-r--r--src/main.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index d707d7c..f94d6a3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,8 +7,8 @@ use std::{thread, time::Duration};
use std::sync::Arc;
use std::fs;
-use hyper::header;
-use hyper::http::response;
+
+
use serde_derive::{Serialize, Deserialize};
use toml;
@@ -40,7 +40,7 @@ fn respond(sc :StatusCode, mes : String) -> Response<Body> {
.unwrap()
}
-fn wrapCORS(mut res: Response<Body>, config :Arc<Config>) -> Response<Body> {
+fn wrap_cors(mut res: Response<Body>, config :Arc<Config>) -> Response<Body> {
res.headers_mut().insert("Access-Control-Allow-Origin", HeaderValue::from_str(&config.cors_hosts).unwrap() );
res.headers_mut().insert("Access-Control-Allow-Methods", HeaderValue::from_static("*"));
res.headers_mut().insert("Access-Control-Allow-Headers", HeaderValue::from_static("*"));
@@ -334,7 +334,7 @@ async fn main() {
let tx = tx.clone();
let config = config.clone();
async move {
- Ok::<_, Infallible>(wrapCORS(handle(req, remote_addr, tx, config.clone()), config.clone()))
+ Ok::<_, Infallible>(wrap_cors(handle(req, remote_addr, tx, config.clone()), config.clone()))
}
}))
}