use hyper::Body; use hyper::Response; use hyper::StatusCode; use serde::Serialize; pub fn text_response(status: StatusCode, body: &str) -> Response
{ Response::builder() .status(status) .header("content-type", "text/plain") .body(Body::from(body.to_string())) .unwrap_or_else(|_| Response::new(Body::from(body.to_string()))) } pub fn json_response