Run rustfmt
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use json;
|
||||
use chrono;
|
||||
use crate::usimp;
|
||||
use super::Method;
|
||||
use crate::usimp;
|
||||
use chrono;
|
||||
use json;
|
||||
|
||||
pub struct HttpStream {
|
||||
stream: super::Stream,
|
||||
@ -30,7 +30,13 @@ pub fn connection_handler(client: super::Stream) {
|
||||
fn request_handler(client: &mut super::HttpStream) {
|
||||
let mut res = super::Response::new();
|
||||
res.add_header("Server", "Locutus");
|
||||
res.add_header("Date", chrono::Utc::now().format("%a, %d %b %Y %H:%M:%S GMT").to_string().as_str());
|
||||
res.add_header(
|
||||
"Date",
|
||||
chrono::Utc::now()
|
||||
.format("%a, %d %b %Y %H:%M:%S GMT")
|
||||
.to_string()
|
||||
.as_str(),
|
||||
);
|
||||
|
||||
let req = super::parser::parse_request(&mut client.stream).unwrap();
|
||||
println!("{} {}", req.method, req.uri);
|
||||
@ -53,14 +59,12 @@ fn request_handler(client: &mut super::HttpStream) {
|
||||
let parts: Vec<&str> = req.uri.split('/').collect();
|
||||
match parts[2..] {
|
||||
["entity", entity] => res.status(501),
|
||||
[func] => {
|
||||
match usimp::is_valid(func) {
|
||||
true => match req.method {
|
||||
Method::POST => res.status(200),
|
||||
_ => res.status(405),
|
||||
},
|
||||
false => res.status(400),
|
||||
}
|
||||
[func] => match usimp::is_valid(func) {
|
||||
true => match req.method {
|
||||
Method::POST => res.status(200),
|
||||
_ => res.status(405),
|
||||
},
|
||||
false => res.status(400),
|
||||
},
|
||||
_ => res.status(400),
|
||||
}
|
||||
|
Reference in New Issue
Block a user