diff options
-rw-r--r-- | src/main.rs | 8 |
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())) } })) } |