better unauthorized ip, and adding responder

This commit is contained in:
2025-01-18 04:04:07 +01:00
parent f5f3ee67a5
commit 3499f430b1
6 changed files with 99 additions and 19 deletions
+2 -5
View File
@@ -3,7 +3,7 @@ use hyper::{
body::{Bytes, Incoming},
Request, Response,
};
use servme::Server;
use servme::{Responder, Server};
use std::convert::Infallible;
#[tokio::main]
@@ -16,8 +16,5 @@ async fn main() {
}
async fn handler(req: Request<Incoming>) -> Result<Response<Full<Bytes>>, Infallible> {
Ok(Response::new(Full::new(Bytes::from(format!(
"Hello World! {}",
req.uri()
)))))
Responder::text(format!("Hello World! {}", req.uri()))
}