servme/src/responder.rs
2025-01-16 20:04:13 +01:00

16 lines
358 B
Rust

use http::Response;
use http_body_util::Full;
use hyper::body::Bytes;
use std::convert::Infallible;
pub struct Responder;
impl Responder {
pub fn unathorized() -> Result<Response<Full<Bytes>>, Infallible> {
Ok(Response::builder()
.status(401)
.body(Full::new(Bytes::from("Unauthorized")))
.unwrap())
}
}